-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `akuntansi`
--

-- --------------------------------------------------------

--
-- Table structure for table `akun`
--

CREATE TABLE `akun` (
  `id` bigint UNSIGNED NOT NULL,
  `kode_akun` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama_akun` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tipe_akun` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `saldo_normal` enum('Debit','Kredit') COLLATE utf8mb4_unicode_ci NOT NULL,
  `saldo` int DEFAULT NULL,
  `parent_id` bigint UNSIGNED DEFAULT NULL,
  `level` int NOT NULL DEFAULT '1',
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `unit_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `akun`
--

INSERT INTO `akun` (`id`, `kode_akun`, `nama_akun`, `tipe_akun`, `saldo_normal`, `saldo`, `parent_id`, `level`, `deskripsi`, `unit_id`, `created_at`, `updated_at`) VALUES
(1, '100000', 'ASET', 'Aset', 'Debit', NULL, NULL, 1, 'Akun induk untuk semua aset', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(2, '110000', 'ASET LANCAR', 'Aset', 'Debit', NULL, 1, 2, NULL, NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(3, '110100', 'Kas di Bendahara', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(4, '110101', 'Kas di Bendahara TK /KB', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(5, '110102', 'Kas di Bendahara SD 01', 'Aset', 'Debit', 100000000, 3, 4, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 13:23:28'),
(6, '110103', 'Kas di Bendahara SD 02', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(7, '110104', 'Kas di Bendahara SMP', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(8, '110105', 'Kas di Bendahara SMA IT', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(9, '110106', 'Kas di Bendahara SMA Boarding', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(10, '110107', 'Kas di Bendahara Asrama', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(11, '110108', 'Kas di Bendahara AADM', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(12, '110109', 'Kas di Bendahara AABS', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(13, '110110', 'Kas di Bendahara ALM', 'Aset', 'Debit', NULL, 3, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(14, '110200', 'Kas di Bank Mandiri Syariah', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(15, '110201', 'Rekening BSM atas nama Taufik', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(16, '110214', 'Al Irsyad Al Islamiyyah Purwokerto BSM', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(17, '110215', 'Nur Fitri Ummyan QQ Operasional LPP', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(18, '110216', 'Nur Sabiha QQ TK Al Irsyad (70261398)', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(19, '110217', 'SD Al Irsyad 01 Purwokerto (707685941)', 'Aset', 'Debit', NULL, 14, 4, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(20, '110218', 'SD Al Irsyad 02 Purwokerto (707538644)', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(21, '110219', 'Alex Nanang AS and Emas Satriat SMP', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(22, '110220', 'Alex Nanang AS and Emas Satriat SMA IT', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(23, '110221', 'Alex Nanang AS and Emas Satriat SMA Boarding', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(24, '110222', 'Nur Hamdan (7110937606)', 'Aset', 'Debit', NULL, 14, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(25, '110300', 'Kas di BRI Syariah', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(26, '110301', 'Nandi and Joko QQ SMP Al Irsyad (101)', 'Aset', 'Debit', NULL, 25, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(27, '110302', 'Muhammad Iqbal and Supriyanto (1025)', 'Aset', 'Debit', NULL, 25, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(28, '110303', 'Muhammad Iqbal or Ritasari (1042012)', 'Aset', 'Debit', NULL, 25, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(29, '110304', 'SD Al Irsyad 02 Purwokerto (10560454)', 'Aset', 'Debit', NULL, 25, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(30, '110305', 'SD Al Irsyad 01 Purwokerto (1078768)', 'Aset', 'Debit', NULL, 25, 4, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(31, '110400', 'Piutang SPP', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(32, '110401', 'Piutang SPP KB /TK', 'Aset', 'Debit', NULL, 31, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(33, '110402', 'Piutang SPP SD 01', 'Aset', 'Debit', NULL, 31, 4, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(34, '110403', 'Piutang SPP SD 02', 'Aset', 'Debit', NULL, 31, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(35, '110404', 'Piutang SPP SMP', 'Aset', 'Debit', NULL, 31, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(36, '110405', 'Piutang SPP SMA IT', 'Aset', 'Debit', NULL, 31, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(37, '110406', 'Piutang SPP SMA Boarding', 'Aset', 'Debit', NULL, 31, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(38, '110407', 'Piutang SPP Asrama', 'Aset', 'Debit', NULL, 31, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(39, '110500', 'Piutang OKP', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(40, '110501', 'Piutang OKP KB /TK', 'Aset', 'Debit', NULL, 39, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(41, '110502', 'Piutang OKP SD 01', 'Aset', 'Debit', NULL, 39, 4, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(42, '110503', 'Piutang OKP SD 02', 'Aset', 'Debit', NULL, 39, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(43, '110504', 'Piutang OKP SMP', 'Aset', 'Debit', NULL, 39, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(44, '110505', 'Piutang OKP SMA IT', 'Aset', 'Debit', NULL, 39, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(45, '110506', 'Piutang OKP SMA Boarding', 'Aset', 'Debit', NULL, 39, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(46, '110507', 'Piutang OKP Asrama', 'Aset', 'Debit', NULL, 39, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(47, '110600', 'Piutang Pengembangan', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(48, '110601', 'Piutang Pengembangan KB /TK', 'Aset', 'Debit', NULL, 47, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(49, '110602', 'Piutang Pengembangan SD 01', 'Aset', 'Debit', NULL, 47, 4, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(50, '110603', 'Piutang Pengembangan SD 02', 'Aset', 'Debit', NULL, 47, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(51, '110604', 'Piutang Pengembangan SMP', 'Aset', 'Debit', NULL, 47, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(52, '110605', 'Piutang Pengembangan SMA IT', 'Aset', 'Debit', NULL, 47, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(53, '110606', 'Piutang Pengembangan SMA Boarding', 'Aset', 'Debit', NULL, 47, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(54, '110607', 'Piutang Pengembangan Asrama', 'Aset', 'Debit', NULL, 47, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(55, '110700', 'Piutang Lain-Lain', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(56, '110701', 'Piutang Lain-Lain', 'Aset', 'Debit', NULL, 55, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(57, '110800', 'Persediaan Usaha', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(58, '110801', 'Persediaan Usaha', 'Aset', 'Debit', NULL, 57, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(59, '110900', 'Pajak Dibayar Dimuka', 'Aset', 'Debit', NULL, 2, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(60, '110901', 'Pajak Dibayar Dimuka', 'Aset', 'Debit', NULL, 59, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(61, '400000', 'PENDAPATAN', 'Pendapatan', 'Kredit', NULL, NULL, 1, 'Akun induk untuk semua pendapatan', NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(62, '410000', 'Pendapatan Utama', 'Pendapatan', 'Kredit', NULL, 61, 2, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(63, '410010', 'Saldo Bulan Lalu', 'Pendapatan', 'Kredit', NULL, 62, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(64, '421000', 'Pendapatan Iuran Orang Tua', 'Pendapatan', 'Kredit', NULL, 62, 3, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(65, '421100', 'Pendapatan SPP', 'Pendapatan', 'Kredit', NULL, 64, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(66, '421101', 'Pendapatan SPP KB /Tk', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(67, '421102', 'Pendapatan SPP SD 01', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(68, '421103', 'Pendapatan SPP SD 02', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(69, '421104', 'Pendapatan SPP SMP', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(70, '421105', 'Pendapatan SPP SMA IT', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(71, '421106', 'Pendapatan SPP SMA Boarding', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(72, '421107', 'Pendapatan SPP SMA Asrama', 'Pendapatan', 'Kredit', NULL, 65, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(73, '421200', 'Pendapatan OKP', 'Pendapatan', 'Kredit', NULL, 64, 4, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(74, '421201', 'Pendapatan OKP KB /TK', 'Pendapatan', 'Kredit', NULL, 73, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(75, '421202', 'Pendapatan OKP SD 01', 'Pendapatan', 'Kredit', 100000000, 73, 5, NULL, 4, '2025-05-20 10:59:03', '2025-05-20 13:23:28'),
(76, '421203', 'Pendapatan OKP SD 02', 'Pendapatan', 'Kredit', NULL, 73, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(77, '421204', 'Pendapatan OKP SMP', 'Pendapatan', 'Kredit', NULL, 73, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(78, '421205', 'Pendapatan OKP SMA IT', 'Pendapatan', 'Kredit', NULL, 73, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(79, '421206', 'Pendapatan OKP SMA Boarding', 'Pendapatan', 'Kredit', NULL, 73, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03'),
(80, '421207', 'Pendapatan OKP Asrama', 'Pendapatan', 'Kredit', NULL, 73, 5, NULL, NULL, '2025-05-20 10:59:03', '2025-05-20 10:59:03');

-- --------------------------------------------------------

--
-- Table structure for table `detail_transaksi`
--

CREATE TABLE `detail_transaksi` (
  `id` bigint UNSIGNED NOT NULL,
  `transaksi_id` bigint UNSIGNED NOT NULL,
  `akun_id` bigint UNSIGNED NOT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT '0.00',
  `kredit` decimal(15,2) NOT NULL DEFAULT '0.00',
  `deskripsi_item` text COLLATE utf8mb4_unicode_ci,
  `unit_id` bigint UNSIGNED DEFAULT NULL,
  `program_kegiatan_id` bigint UNSIGNED DEFAULT NULL,
  `jenis_pendanaan_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `detail_transaksi`
--

INSERT INTO `detail_transaksi` (`id`, `transaksi_id`, `akun_id`, `debit`, `kredit`, `deskripsi_item`, `unit_id`, `program_kegiatan_id`, `jenis_pendanaan_id`, `created_at`, `updated_at`) VALUES
(6, 6, 5, '100000000.00', '0.00', 'Kas Tunai Donasi', 1, NULL, NULL, '2025-05-20 13:22:25', '2025-05-20 13:23:28'),
(7, 6, 75, '0.00', '100000000.00', 'Donasi Bapak Budi', NULL, NULL, NULL, '2025-05-20 13:22:25', '2025-05-20 13:23:28');

-- --------------------------------------------------------

--
-- Table structure for table `donatur`
--

CREATE TABLE `donatur` (
  `id` bigint UNSIGNED NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `jenis_identitas` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `nomor_identitas` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kota` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `provinsi` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kode_pos` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `negara` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telepon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint UNSIGNED NOT NULL,
  `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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `jenis_pendanaan`
--

CREATE TABLE `jenis_pendanaan` (
  `id` bigint UNSIGNED NOT NULL,
  `kode_pendanaan` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `parent_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2025_05_17_140412_create_donatur_table', 1),
(6, '2025_05_17_140415_create_pelanggan_table', 1),
(7, '2025_05_17_140417_create_pemasok_table', 1),
(8, '2025_05_17_140422_create_jenis_pendanaan_table', 1),
(9, '2025_05_17_140647_create_units_table', 1),
(10, '2025_05_17_141750_create_roles_table', 1),
(11, '2025_05_17_150204_add_role_and_unit_to_users_table', 1),
(12, '2025_05_17_150419_create_program_kegiatan_table', 1),
(13, '2025_05_17_150424_create_produk_layanan_table', 1),
(14, '2025_05_17_150426_create_transaksi_table', 1),
(15, '2025_05_17_164457_add_parent_id_to_units_table', 1),
(16, '2025_05_17_174834_create_akun_table', 1),
(17, '2025_05_17_180007_add_unit_id_to_akun_table', 1),
(18, '2025_05_18_071550_add_kode_unit_to_units_table', 1),
(19, '2025_05_18_080808_add_kode_pendanaan_to_jenis_pendanaan_table', 1),
(20, '2025_05_18_081404_add_parent_id_to_jenis_pendanaan_table', 1),
(21, '2025_05_18_150428_create_detail_transaksi_table', 1),
(22, '2025_05_18_175659_add_tipe_transaksi_to_transaksi_table', 1);

-- --------------------------------------------------------

--
-- Table structure for table `pelanggan`
--

CREATE TABLE `pelanggan` (
  `id` bigint UNSIGNED NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telepon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `pemasok`
--

CREATE TABLE `pemasok` (
  `id` bigint UNSIGNED NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `alamat` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telepon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `produk_layanan`
--

CREATE TABLE `produk_layanan` (
  `id` bigint UNSIGNED NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `harga` decimal(15,2) NOT NULL,
  `unit_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `program_kegiatan`
--

CREATE TABLE `program_kegiatan` (
  `id` bigint UNSIGNED NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `unit_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- --------------------------------------------------------

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` bigint UNSIGNED NOT NULL,
  `nama` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `nama`, `deskripsi`, `created_at`, `updated_at`) VALUES
(1, 'Super Admin', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(2, 'Admin Unit', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(3, 'Operator Keuangan', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(4, 'Guru', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(5, 'Staf Umum', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02');

-- --------------------------------------------------------

--
-- Table structure for table `transaksi`
--

CREATE TABLE `transaksi` (
  `id` bigint UNSIGNED NOT NULL,
  `nomor_bukti` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `tanggal` date NOT NULL,
  `jenis_transaksi` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `tipe_transaksi` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit_id` bigint UNSIGNED NOT NULL,
  `user_id` bigint UNSIGNED NOT NULL,
  `metode_pembayaran` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `program_kegiatan_id` bigint UNSIGNED DEFAULT NULL,
  `jenis_pendanaan_id` bigint UNSIGNED DEFAULT NULL,
  `saldo` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `transaksi`
--

INSERT INTO `transaksi` (`id`, `nomor_bukti`, `tanggal`, `jenis_transaksi`, `deskripsi`, `tipe_transaksi`, `unit_id`, `user_id`, `metode_pembayaran`, `program_kegiatan_id`, `jenis_pendanaan_id`, `saldo`, `created_at`, `updated_at`) VALUES
(6, 'PK-20250520-001', '2025-05-20', 'Penerimaan Kas', 'donasi', 'Penerimaan Kas', 1, 1, NULL, NULL, NULL, NULL, '2025-05-20 13:22:25', '2025-05-20 13:22:25');

-- --------------------------------------------------------

--
-- Table structure for table `units`
--

CREATE TABLE `units` (
  `id` bigint UNSIGNED NOT NULL,
  `nama_unit` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `jenis_unit` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `kode_unit` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `deskripsi` text COLLATE utf8mb4_unicode_ci,
  `parent_id` bigint UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `units`
--

INSERT INTO `units` (`id`, `nama_unit`, `jenis_unit`, `kode_unit`, `deskripsi`, `parent_id`, `created_at`, `updated_at`) VALUES
(1, 'Yayasan Pusat', NULL, NULL, 'Unit induk untuk seluruh yayasan.', NULL, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(2, 'Divisi Pendidikan', NULL, NULL, 'Divisi yang mengelola semua unit pendidikan.', 1, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(3, 'Divisi Keuangan', NULL, NULL, 'Divisi yang mengelola semua aspek keuangan yayasan.', 1, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(4, 'SD Al Irsyad 01', NULL, NULL, 'Sekolah Dasar Al Irsyad Purwokerto 01.', 2, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(5, 'SD Al Irsyad 02', NULL, NULL, 'Sekolah Dasar Al Irsyad Purwokerto 02.', 2, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(6, 'SMP Al Irsyad', NULL, NULL, 'Sekolah Menengah Pertama Al Irsyad Purwokerto.', 2, '2025-05-20 10:59:02', '2025-05-20 10:59:02'),
(7, 'Divisi Logistik', NULL, NULL, 'Divisi yang mengelola pengadaan dan inventaris.', 1, '2025-05-20 10:59:02', '2025-05-20 10:59:02');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `akun`
--
ALTER TABLE `akun`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `akun_kode_akun_unique` (`kode_akun`),
  ADD KEY `akun_unit_id_foreign` (`unit_id`),
  ADD KEY `akun_parent_id_foreign` (`parent_id`);

--
-- Indexes for table `detail_transaksi`
--
ALTER TABLE `detail_transaksi`
  ADD PRIMARY KEY (`id`),
  ADD KEY `detail_transaksi_transaksi_id_foreign` (`transaksi_id`),
  ADD KEY `detail_transaksi_akun_id_foreign` (`akun_id`),
  ADD KEY `detail_transaksi_unit_id_foreign` (`unit_id`),
  ADD KEY `detail_transaksi_program_kegiatan_id_foreign` (`program_kegiatan_id`),
  ADD KEY `detail_transaksi_jenis_pendanaan_id_foreign` (`jenis_pendanaan_id`);

--
-- Indexes for table `donatur`
--
ALTER TABLE `donatur`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `donatur_nomor_identitas_unique` (`nomor_identitas`),
  ADD UNIQUE KEY `donatur_email_unique` (`email`);

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `jenis_pendanaan`
--
ALTER TABLE `jenis_pendanaan`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `jenis_pendanaan_nama_unique` (`nama`),
  ADD UNIQUE KEY `jenis_pendanaan_kode_pendanaan_unique` (`kode_pendanaan`),
  ADD KEY `jenis_pendanaan_parent_id_foreign` (`parent_id`);

--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pelanggan`
--
ALTER TABLE `pelanggan`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pemasok`
--
ALTER TABLE `pemasok`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `produk_layanan`
--
ALTER TABLE `produk_layanan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `produk_layanan_unit_id_foreign` (`unit_id`);

--
-- Indexes for table `program_kegiatan`
--
ALTER TABLE `program_kegiatan`
  ADD PRIMARY KEY (`id`),
  ADD KEY `program_kegiatan_unit_id_foreign` (`unit_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_nama_unique` (`nama`);

--
-- Indexes for table `transaksi`
--
ALTER TABLE `transaksi`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `transaksi_nomor_bukti_unique` (`nomor_bukti`),
  ADD KEY `transaksi_unit_id_foreign` (`unit_id`),
  ADD KEY `transaksi_user_id_foreign` (`user_id`),
  ADD KEY `transaksi_program_kegiatan_id_foreign` (`program_kegiatan_id`),
  ADD KEY `transaksi_jenis_pendanaan_id_foreign` (`jenis_pendanaan_id`);

--
-- Indexes for table `units`
--
ALTER TABLE `units`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `units_nama_unit_unique` (`nama_unit`),
  ADD UNIQUE KEY `units_kode_unit_unique` (`kode_unit`),
  ADD KEY `units_parent_id_foreign` (`parent_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `akun`
--
ALTER TABLE `akun`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=81;

--
-- AUTO_INCREMENT for table `detail_transaksi`
--
ALTER TABLE `detail_transaksi`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `donatur`
--
ALTER TABLE `donatur`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `jenis_pendanaan`
--
ALTER TABLE `jenis_pendanaan`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT for table `pelanggan`
--
ALTER TABLE `pelanggan`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pemasok`
--
ALTER TABLE `pemasok`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `produk_layanan`
--
ALTER TABLE `produk_layanan`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `program_kegiatan`
--
ALTER TABLE `program_kegiatan`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `transaksi`
--
ALTER TABLE `transaksi`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
  MODIFY `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `akun`
--
ALTER TABLE `akun`
  ADD CONSTRAINT `akun_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `akun` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `akun_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `detail_transaksi`
--
ALTER TABLE `detail_transaksi`
  ADD CONSTRAINT `detail_transaksi_akun_id_foreign` FOREIGN KEY (`akun_id`) REFERENCES `akun` (`id`) ON DELETE RESTRICT,
  ADD CONSTRAINT `detail_transaksi_jenis_pendanaan_id_foreign` FOREIGN KEY (`jenis_pendanaan_id`) REFERENCES `jenis_pendanaan` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `detail_transaksi_program_kegiatan_id_foreign` FOREIGN KEY (`program_kegiatan_id`) REFERENCES `program_kegiatan` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `detail_transaksi_transaksi_id_foreign` FOREIGN KEY (`transaksi_id`) REFERENCES `transaksi` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `detail_transaksi_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `jenis_pendanaan`
--
ALTER TABLE `jenis_pendanaan`
  ADD CONSTRAINT `jenis_pendanaan_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `jenis_pendanaan` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `produk_layanan`
--
ALTER TABLE `produk_layanan`
  ADD CONSTRAINT `produk_layanan_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `program_kegiatan`
--
ALTER TABLE `program_kegiatan`
  ADD CONSTRAINT `program_kegiatan_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `transaksi`
--
ALTER TABLE `transaksi`
  ADD CONSTRAINT `transaksi_jenis_pendanaan_id_foreign` FOREIGN KEY (`jenis_pendanaan_id`) REFERENCES `jenis_pendanaan` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transaksi_program_kegiatan_id_foreign` FOREIGN KEY (`program_kegiatan_id`) REFERENCES `program_kegiatan` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `transaksi_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT,
  ADD CONSTRAINT `transaksi_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT;

--
-- Constraints for table `units`
--
ALTER TABLE `units`
  ADD CONSTRAINT `units_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;
COMMIT;

