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

START TRANSACTION;



--
-- Database: `gas`
--

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

--
-- Table structure for table `harga_pokok`
--

CREATE TABLE `harga_pokok` (
  `id` varchar(10) NOT NULL,
  `jenis_barang` varchar(50) NOT NULL,
  `jumlah` int NOT NULL,
  `harga_satuan` int NOT NULL,
  `total_harga` int NOT NULL,
  `tanggal` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `harga_pokok`
--

INSERT INTO `harga_pokok` (`id`, `jenis_barang`, `jumlah`, `harga_satuan`, `total_harga`, `tanggal`) VALUES
('PK1452', 'Gas 3kg', 121, 16500, 1996500, '2026-01-03 11:11:35'),
('PK4054', 'Aqua Galon', 20, 17500, 350000, '2026-01-08 22:45:45'),
('PK5587', 'Gas 12kg', 2, 185000, 370000, '2026-01-08 22:46:00');

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

--
-- Table structure for table `harga_produk`
--

CREATE TABLE `harga_produk` (
  `id_harga` char(6) NOT NULL,
  `kategori` enum('Gas 3kg','Gas 12kg','Aqua Galon') NOT NULL,
  `harga` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `harga_produk`
--

INSERT INTO `harga_produk` (`id_harga`, `kategori`, `harga`) VALUES
('AQUA1', 'Aqua Galon', '19000.00'),
('GAS19', 'Gas 3kg', '19000.00'),
('GAS195', 'Gas 3kg', '19500.00'),
('GAS20', 'Gas 3kg', '20000.00'),
('GAS205', 'Gas 3kg', '20500.00'),
('GAS21', 'Gas 3kg', '21000.00'),
('GAS215', 'Gas 3kg', '21500.00'),
('GAS22', 'Gas 3kg', '22000.00');

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

--
-- Table structure for table `laporan_harian`
--

CREATE TABLE `laporan_harian` (
  `id` int NOT NULL,
  `tanggal` date NOT NULL,
  `total_transaksi` int NOT NULL,
  `uang_bongkar` int NOT NULL DEFAULT '0',
  `bensin` int NOT NULL DEFAULT '0',
  `lainnya` int NOT NULL DEFAULT '0',
  `total_biaya` int NOT NULL,
  `total_bersih` int NOT NULL,
  `nominal_transfer` int NOT NULL DEFAULT '0',
  `sisa_cash` int NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `laporan_harian`
--

INSERT INTO `laporan_harian` (`id`, `tanggal`, `total_transaksi`, `uang_bongkar`, `bensin`, `lainnya`, `total_biaya`, `total_bersih`, `nominal_transfer`, `sisa_cash`, `created_at`, `updated_at`) VALUES
(3, '2026-01-08', 4474500, 15000, 0, 40000, 55000, 4419500, 4419500, 0, '2026-01-08 15:28:37', '2026-01-08 15:28:37');

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

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

CREATE TABLE `pelanggan` (
  `id_pelanggan` varchar(15) NOT NULL,
  `id_harga` char(6) DEFAULT NULL,
  `kategori` enum('Gas 3kg','Gas 12kg','Aqua Galon') NOT NULL,
  `harga` decimal(10,2) DEFAULT NULL,
  `nama_pelanggan` varchar(100) DEFAULT NULL,
  `no_hp` varchar(20) DEFAULT NULL,
  `alamat` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `pelanggan`
--

INSERT INTO `pelanggan` (`id_pelanggan`, `id_harga`, `kategori`, `harga`, `nama_pelanggan`, `no_hp`, `alamat`) VALUES
('PLG001', 'GAS19', 'Gas 3kg', '19000.00', 'Alisa', '08111', 'Kp.Sentul'),
('PLG002', 'GAS19', 'Gas 3kg', '19000.00', 'sinar jaya', '08111', 'kp cipari'),
('PLG003', 'GAS19', 'Gas 3kg', '19000.00', 'dina a', '0', 'cukanggalih'),
('PLG004', 'GAS19', 'Gas 3kg', '19000.00', 'dina b', '0', 'cipari'),
('PLG005', 'GAS19', 'Gas 3kg', '19000.00', 'dina c', '0', 'kitri bakti'),
('PLG006', 'GAS19', 'Gas 3kg', '19000.00', 'alan', '0', 'Parigi'),
('PLG007', 'GAS195', 'Gas 3kg', '19500.00', 'raihan a', '0', 'Kp onyam'),
('PLG008', 'GAS19', 'Gas 3kg', '19000.00', 'raihan b', '0', 'pasirandu'),
('PLG009', 'GAS19', 'Gas 3kg', '19000.00', 'ulfa soka b', '0', 'kp cisereh'),
('PLG010', 'GAS19', 'Gas 3kg', '19000.00', 'depan makam', '0', 'kp cisereh'),
('PLG011', 'GAS19', 'Gas 3kg', '19000.00', 'adi madura', '0', 'kp cisereh'),
('PLG012', 'GAS19', 'Gas 3kg', '19000.00', 'nova', '0', 'kp cisereh'),
('PLG013', 'GAS19', 'Gas 3kg', '19000.00', 'warteg asih', '0', 'kp cisereh'),
('PLG014', 'GAS19', 'Gas 3kg', '19000.00', 'berta', '0', 'kp cisereh'),
('PLG015', 'GAS195', 'Gas 3kg', '19500.00', 'sardi', '0', 'gg ambon'),
('PLG016', 'GAS19', 'Gas 3kg', '19000.00', 'nining', '0', 'kp cisereh'),
('PLG017', 'GAS205', 'Gas 3kg', '20500.00', 'haryanto pecel lele', '0', 'kp cisereh'),
('PLG018', 'GAS19', 'Gas 3kg', '19000.00', 'ageng sayur', '0', 'kp cisereh'),
('PLG019', 'GAS20', 'Gas 3kg', '20000.00', 'Opik (Sardi)', '0', 'gg ambon'),
('PLG020', 'GAS20', 'Gas 3kg', '20000.00', 'suhro', '0', 'kp cisereh'),
('PLG021', 'GAS205', 'Gas 3kg', '20500.00', 'wiwit (Winda)', '0', 'kp cisereh'),
('PLG022', 'AQUA1', 'Aqua Galon', '19000.00', 'sukabakti', '0', 'kp sukabakti'),
('PLG023', 'GAS20', 'Gas 3kg', '20000.00', 'sukabakti', '0', 'kp sukabakti'),
('PLG024', 'GAS21', 'Gas 3kg', '21000.00', 'trimo', '0', 'kp cisereh'),
('PLG025', 'GAS19', 'Gas 3kg', '19000.00', 'eman', '0', 'kp cisereh'),
('PLG026', 'GAS205', 'Gas 3kg', '20500.00', 'kholis', '0', 'kp cisereh'),
('PLG027', 'GAS20', 'Gas 3kg', '20000.00', 'wiwik', '0', 'kp cisereh'),
('PLG028', 'GAS195', 'Gas 3kg', '19500.00', 'yanti', '0', 'kp cisereh'),
('PLG029', 'GAS19', 'Gas 3kg', '19000.00', 'suro', '0', 'kp cisereh'),
('PLG030', 'GAS205', 'Gas 3kg', '20500.00', 'sukri', '0', 'kp cisereh'),
('PLG031', 'GAS21', 'Gas 3kg', '21000.00', 'lilis', '0', 'kp cisereh'),
('PLG032', 'GAS21', 'Gas 3kg', '21000.00', 'bad', '0', 'kp cisereh'),
('PLG033', 'GAS19', 'Gas 3kg', '19000.00', 'lubis', '0', 'kp cisereh'),
('PLG034', 'GAS195', 'Gas 3kg', '19500.00', 'mad supri', '0', 'kp sukabakti'),
('PLG035', 'GAS19', 'Gas 3kg', '19000.00', 'dua putri', '0', 'kp sukabakti'),
('PLG036', 'GAS19', 'Gas 3kg', '19000.00', 'sumber rezeki', '0', 'kp sentul'),
('PLG037', 'GAS195', 'Gas 3kg', '19500.00', 'tabri', '0', 'kp curug wetan'),
('PLG038', 'GAS19', 'Gas 3kg', '19000.00', 'mad hari', '0', 'curug kulon'),
('PLG039', 'GAS19', 'Gas 3kg', '19000.00', 'arifin', '0', 'perumahan blkg pasar'),
('PLG040', 'GAS19', 'Gas 3kg', '19000.00', 'mila a', '0', 'kp curug kulon'),
('PLG041', 'GAS19', 'Gas 3kg', '19000.00', 'mila b', '0', 'kp curug kulon'),
('PLG042', 'GAS19', 'Gas 3kg', '19000.00', 'bu tami', '0', 'kp curug kulon'),
('PLG043', 'GAS19', 'Gas 3kg', '19000.00', 'doa ibu', '0', 'kp sentul'),
('PLG044', 'GAS19', 'Gas 3kg', '19000.00', 'alif', '0', 'kp curug kulon'),
('PLG045', 'GAS20', 'Gas 3kg', '20000.00', 'teh neng', '0', 'kp sentul'),
('PLG046', 'GAS20', 'Gas 3kg', '20000.00', 'wawa', '0', 'kp sentul'),
('PLG047', 'GAS20', 'Gas 3kg', '20000.00', 'asti', '0', 'kp sentul'),
('PLG048', 'GAS19', 'Gas 3kg', '19000.00', 'bapak motor', '0', 'kp sentul'),
('PLG049', 'GAS20', 'Gas 3kg', '20000.00', 'bu anih', '0', 'kp cukanggalih'),
('PLG050', 'GAS20', 'Gas 3kg', '20000.00', 'cek rum', '0', 'kp cukanggalih'),
('PLG051', 'GAS20', 'Gas 3kg', '20000.00', 'junaidi', '0', 'kp cukanggalih'),
('PLG052', 'GAS19', 'Gas 3kg', '19000.00', 'rusnan', '0', 'kp cukanggalih'),
('PLG053', 'GAS195', 'Gas 3kg', '19500.00', 'jaro', '0', 'kp cukanggalih'),
('PLG054', 'GAS205', 'Gas 3kg', '20500.00', 'resti', '0', 'kp cukanggalih'),
('PLG055', 'GAS20', 'Gas 3kg', '20000.00', 'yokim', '0', 'kp cukanggalih'),
('PLG056', 'GAS19', 'Gas 3kg', '19000.00', 'rofiq', '0', 'perum griya catania'),
('PLG057', 'GAS19', 'Gas 3kg', '19000.00', 'rosid', '0', 'jl padat karya'),
('PLG058', 'GAS20', 'Gas 3kg', '20000.00', 'ikin', '0', 'jl padat karya'),
('PLG059', 'GAS21', 'Gas 3kg', '21000.00', 'bu ating', '0', 'kp curug kulon'),
('PLG060', 'GAS21', 'Gas 3kg', '21000.00', 'Riska', '0', 'Perum Grand Mansion'),
('PLG061', 'GAS21', 'Gas 3kg', '21000.00', 'udin', '0', 'Perum Grand Mansion'),
('PLG062', 'GAS21', 'Gas 3kg', '21000.00', 'sugeng', '0', 'Perum Grand Mansion'),
('PLG063', 'GAS21', 'Gas 3kg', '21000.00', 'sunarni', '0', 'Perum Grand Mansion'),
('PLG064', 'GAS21', 'Gas 3kg', '21000.00', 'dwi', '0', 'Perum Grand Mansion'),
('PLG065', 'GAS21', 'Gas 3kg', '21000.00', 'nadin', '0', 'Perum Grand Mansion'),
('PLG066', 'GAS19', 'Gas 3kg', '19000.00', 'jahra', '0', 'kp sentul'),
('PLG067', 'GAS21', 'Gas 3kg', '21000.00', 'umum', '0', 'kp sentul'),
('PLG068', 'GAS22', 'Gas 3kg', '22000.00', 'tahu sumedang', '0', 'Depan Alfamidi'),
('PLG069', 'GAS19', 'Gas 3kg', '19000.00', 'lala', '0', 'kp sentul'),
('PLG070', 'GAS19', 'Gas 3kg', '19000.00', 'madura', '0', 'random'),
('PLG071', 'GAS19', 'Gas 3kg', '19000.00', 'ulfa soka a', '0', 'kp soka');

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

--
-- Table structure for table `pembayaran`
--

CREATE TABLE `pembayaran` (
  `id_pembayaran` int NOT NULL,
  `id_transaksi` int NOT NULL,
  `jumlah_bayar` decimal(10,2) NOT NULL,
  `tanggal_bayar` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

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

CREATE TABLE `transaksi` (
  `id_transaksi` int NOT NULL,
  `id_pelanggan` varchar(15) DEFAULT NULL,
  `kategori` enum('Gas 3kg','Gas 12kg','Aqua Galon') DEFAULT NULL,
  `harga` decimal(10,2) DEFAULT NULL,
  `jumlah` int DEFAULT NULL,
  `total` decimal(12,2) DEFAULT NULL,
  `tanggal` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `metode_pembayaran` enum('Tunai','Transfer','Split Bill') DEFAULT 'Tunai',
  `bayar_sekarang` decimal(10,2) DEFAULT '0.00',
  `hutang` decimal(10,2) DEFAULT '0.00',
  `status_hutang` enum('Lunas','Belum Lunas') DEFAULT 'Lunas',
  `tanggal_lunas` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `transaksi` (`id_transaksi`, `id_pelanggan`, `kategori`, `harga`, `jumlah`, `total`, `tanggal`, `metode_pembayaran`, `bayar_sekarang`, `hutang`, `status_hutang`, `tanggal_lunas`) VALUES
(91, 'PLG068', 'Gas 3kg', '22000.00', 2, '43000.00', '2026-01-08 15:20:30', 'Split Bill', '0.00', '43000.00', 'Belum Lunas', NULL),
(92, 'PLG023', 'Gas 3kg', '20000.00', 21, '0.00', '2026-01-08 15:20:49', 'Tunai', '0.00', '0.00', 'Lunas', '2026-01-08 22:20:49'),
(93, 'PLG007', 'Gas 3kg', '19500.00', 9, '175500.00', '2026-01-08 15:21:11', 'Tunai', '175500.00', '0.00', 'Lunas', '2026-01-08 22:21:11'),
(94, 'PLG008', 'Gas 3kg', '19000.00', 7, '133000.00', '2026-01-08 15:21:26', 'Tunai', '133000.00', '0.00', 'Lunas', '2026-01-08 22:21:26'),
(95, 'PLG028', 'Gas 3kg', '19500.00', 18, '351000.00', '2026-01-08 15:21:44', 'Tunai', '351000.00', '0.00', 'Lunas', '2026-01-08 22:21:44'),
(96, 'PLG070', 'Gas 3kg', '19000.00', 7, '133000.00', '2026-01-08 15:22:07', 'Tunai', '133000.00', '0.00', 'Lunas', '2026-01-08 22:22:07'),
(97, 'PLG011', 'Gas 3kg', '19000.00', 5, '95000.00', '2026-01-08 15:22:20', 'Tunai', '95000.00', '0.00', 'Lunas', '2026-01-08 22:22:20'),
(98, 'PLG016', 'Gas 3kg', '19000.00', 22, '418000.00', '2026-01-08 15:22:34', 'Tunai', '418000.00', '0.00', 'Lunas', '2026-01-08 22:22:34'),
(99, 'PLG017', 'Gas 3kg', '20500.00', 1, '20000.00', '2026-01-08 15:22:49', 'Tunai', '20000.00', '0.00', 'Lunas', '2026-01-08 22:22:49'),
(100, 'PLG033', 'Gas 3kg', '19000.00', 10, '190000.00', '2026-01-08 15:23:03', 'Tunai', '190000.00', '0.00', 'Lunas', '2026-01-08 22:23:03'),
(101, 'PLG031', 'Gas 3kg', '21000.00', 8, '160000.00', '2026-01-08 15:23:18', 'Tunai', '160000.00', '0.00', 'Lunas', '2026-01-08 22:23:18'),
(102, 'PLG009', 'Gas 3kg', '19000.00', 10, '190000.00', '2026-01-08 15:23:34', 'Tunai', '190000.00', '0.00', 'Lunas', '2026-01-08 22:23:34'),
(103, 'PLG047', 'Gas 3kg', '20000.00', 3, '60000.00', '2026-01-08 15:23:46', 'Tunai', '60000.00', '0.00', 'Lunas', '2026-01-08 22:23:46'),
(104, 'PLG043', 'Gas 3kg', '19000.00', 16, '304000.00', '2026-01-08 15:23:58', 'Tunai', '304000.00', '0.00', 'Lunas', '2026-01-08 22:23:58'),
(105, 'PLG056', 'Gas 3kg', '19000.00', 15, '285000.00', '2026-01-08 15:24:20', 'Tunai', '285000.00', '0.00', 'Lunas', '2026-01-08 22:24:20'),
(106, 'PLG004', 'Gas 3kg', '19000.00', 15, '285000.00', '2026-01-08 15:24:34', 'Tunai', '285000.00', '0.00', 'Lunas', '2026-01-08 22:24:34'),
(107, 'PLG070', 'Gas 3kg', '19000.00', 6, '114000.00', '2026-01-08 15:24:50', 'Tunai', '114000.00', '0.00', 'Lunas', '2026-01-08 22:24:50'),
(108, 'PLG057', 'Gas 3kg', '19000.00', 16, '304000.00', '2026-01-08 15:25:03', 'Tunai', '304000.00', '0.00', 'Lunas', '2026-01-08 22:25:03'),
(109, 'PLG059', 'Gas 3kg', '21000.00', 3, '60000.00', '2026-01-08 15:25:16', 'Tunai', '60000.00', '0.00', 'Lunas', '2026-01-08 22:25:16'),
(110, 'PLG060', 'Gas 3kg', '21000.00', 3, '60000.00', '2026-01-08 15:25:34', 'Tunai', '60000.00', '0.00', 'Lunas', '2026-01-08 22:25:34'),
(111, 'PLG064', 'Gas 3kg', '21000.00', 7, '140000.00', '2026-01-08 15:25:47', 'Tunai', '140000.00', '0.00', 'Lunas', '2026-01-08 22:25:47'),
(112, 'PLG061', 'Gas 3kg', '21000.00', 2, '40000.00', '2026-01-08 15:26:02', 'Tunai', '40000.00', '0.00', 'Lunas', '2026-01-08 22:26:02'),
(113, 'PLG063', 'Gas 3kg', '21000.00', 4, '80000.00', '2026-01-08 15:26:16', 'Tunai', '80000.00', '0.00', 'Lunas', '2026-01-08 22:26:16'),
(114, 'PLG062', 'Gas 3kg', '21000.00', 3, '60000.00', '2026-01-08 15:26:33', 'Tunai', '60000.00', '0.00', 'Lunas', '2026-01-08 22:26:33'),
(115, 'PLG038', 'Gas 3kg', '19000.00', 13, '247000.00', '2026-01-08 15:26:54', 'Tunai', '247000.00', '0.00', 'Lunas', '2026-01-08 22:26:54'),
(116, 'PLG040', 'Gas 3kg', '19000.00', 22, '418000.00', '2026-01-08 15:27:09', 'Tunai', '418000.00', '0.00', 'Lunas', '2026-01-08 22:27:09'),
(117, 'PLG069', 'Gas 3kg', '19000.00', 8, '152000.00', '2026-01-08 15:27:24', 'Tunai', '152000.00', '0.00', 'Lunas', '2026-01-08 22:27:24');

--
-- Indexes for dumped tables
--

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

--
-- Indexes for table `harga_produk`
--
ALTER TABLE `harga_produk`
  ADD PRIMARY KEY (`id_harga`);

--
-- Indexes for table `laporan_harian`
--
ALTER TABLE `laporan_harian`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `tanggal` (`tanggal`);

--
-- Indexes for table `pelanggan`
--
ALTER TABLE `pelanggan`
  ADD PRIMARY KEY (`id_pelanggan`),
  ADD KEY `id_harga` (`id_harga`);

--
-- Indexes for table `pembayaran`
--
ALTER TABLE `pembayaran`
  ADD PRIMARY KEY (`id_pembayaran`),
  ADD KEY `id_transaksi` (`id_transaksi`);

--
-- Indexes for table `transaksi`
--
ALTER TABLE `transaksi`
  ADD PRIMARY KEY (`id_transaksi`),
  ADD KEY `fk_transaksi_pelanggan` (`id_pelanggan`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `laporan_harian`
--
ALTER TABLE `laporan_harian`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `pembayaran`
--
ALTER TABLE `pembayaran`
  MODIFY `id_pembayaran` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `transaksi`
--
ALTER TABLE `transaksi`
  MODIFY `id_transaksi` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=118;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `pelanggan`
--
ALTER TABLE `pelanggan`
  ADD CONSTRAINT `pelanggan_ibfk_1` FOREIGN KEY (`id_harga`) REFERENCES `harga_produk` (`id_harga`);

--
-- Constraints for table `pembayaran`
--
ALTER TABLE `pembayaran`
  ADD CONSTRAINT `pembayaran_ibfk_1` FOREIGN KEY (`id_transaksi`) REFERENCES `transaksi` (`id_transaksi`) ON DELETE CASCADE;
COMMIT;

