-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Dec 10, 2025 at 11:12 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.0.30

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `billing_app`
--

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

--
-- Table structure for table `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED DEFAULT NULL,
  `action_type` varchar(50) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `related_id` bigint(20) UNSIGNED DEFAULT NULL,
  `related_table` varchar(50) DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `log_date` date NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED
PARTITION BY RANGE (year(`log_date`) * 100 + month(`log_date`))
(
PARTITION p2025_01 VALUES LESS THAN (202502) ENGINE=InnoDB,
PARTITION p2025_02 VALUES LESS THAN (202503) ENGINE=InnoDB,
PARTITION p2025_03 VALUES LESS THAN (202504) ENGINE=InnoDB,
PARTITION p_future VALUES LESS THAN MAXVALUE ENGINE=InnoDB
);

--
-- Dumping data for table `activity_logs`
--

INSERT INTO `activity_logs` (`id`, `user_id`, `action_type`, `description`, `related_id`, `related_table`, `ip_address`, `log_date`, `created_at`) VALUES
(1, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:40:28'),
(2, 1, 'user_enable', 'User \'rased\' enabled successfully', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:40:30'),
(3, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-02-18 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:48:49'),
(4, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-04-10 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:48:56'),
(5, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-01 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:49:02'),
(6, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-02-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:49:05'),
(7, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-04 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:49:10'),
(8, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:54:00'),
(9, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:54:01'),
(10, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:54:02'),
(11, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 09:54:02'),
(12, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:06:37'),
(13, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:06:37'),
(14, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:06:37'),
(15, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:06:38'),
(16, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:10:10'),
(17, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:10:11'),
(18, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:10:12'),
(19, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:10:12'),
(20, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:13:14'),
(21, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:13:15'),
(22, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:13:15'),
(23, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:13:16'),
(24, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:16:18'),
(25, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:16:19'),
(26, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:16:19'),
(27, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:16:20'),
(28, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:19:12'),
(29, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:19:12'),
(30, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:19:13'),
(31, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:19:14'),
(32, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:23:33'),
(33, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:23:33'),
(34, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:23:34'),
(35, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:23:34'),
(36, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:26:41'),
(37, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:26:41'),
(38, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:26:42'),
(39, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:26:42'),
(40, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:33:34'),
(41, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-11 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:33:35'),
(42, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:33:35'),
(43, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:33:36'),
(44, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:39:00'),
(45, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:39:00'),
(46, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:39:01'),
(47, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:39:01'),
(48, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:45:16'),
(49, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:45:17'),
(50, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-10 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:45:17'),
(51, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:45:18'),
(52, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:53:28'),
(53, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:53:28'),
(54, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:53:29'),
(55, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:53:29'),
(56, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:56:50'),
(57, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:56:51'),
(58, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-18 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:56:51'),
(59, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:56:52'),
(60, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:58:54'),
(61, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:58:54'),
(62, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:58:55'),
(63, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-17 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:58:56'),
(64, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 10:59:02'),
(65, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:02:13'),
(66, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:02:14'),
(67, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:02:26'),
(68, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-18 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:03:20'),
(69, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:54:09'),
(70, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:54:09'),
(71, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:54:10'),
(72, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-11 to 2025-12-11', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 11:54:10'),
(73, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-14 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:38:00'),
(74, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-10 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:38:01'),
(75, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:38:02'),
(76, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:38:02'),
(77, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:38:06'),
(78, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:44:06'),
(79, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:44:06'),
(80, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-11 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:44:07'),
(81, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:44:07'),
(82, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:54:14'),
(83, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:54:14'),
(84, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-10 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:54:15'),
(85, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-09 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 12:54:15'),
(86, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-26 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:33:42'),
(87, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-18 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:33:43'),
(88, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-19 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:33:44'),
(89, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-12 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:33:45'),
(90, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:35:08'),
(91, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:50:45'),
(92, 1, 'user_enable', 'User \'rased\' enabled successfully', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:50:46'),
(93, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:56:21'),
(94, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-19 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:56:22'),
(95, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-14 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:56:22'),
(96, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-12 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 13:56:22'),
(97, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:10:48'),
(98, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:10:48'),
(99, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:10:49'),
(100, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:10:49'),
(101, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:15:38'),
(102, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:15:38'),
(103, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:15:39'),
(104, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:15:39'),
(105, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:15:45'),
(106, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:16:54'),
(107, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:16:55'),
(108, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:16:55'),
(109, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:16:55'),
(110, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:20:39'),
(111, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:20:39'),
(112, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:20:40'),
(113, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:20:40'),
(114, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:31:20'),
(115, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:31:21'),
(116, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:31:21'),
(117, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:31:22'),
(118, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:32:43'),
(119, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2025-12-04 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:32:44'),
(120, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-01 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:32:44'),
(121, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-04-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:32:45'),
(122, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:46:32'),
(123, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-02-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:46:33'),
(124, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:46:33'),
(125, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 14:46:34'),
(126, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:15:51'),
(127, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:15:51'),
(128, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:15:51'),
(129, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:15:52'),
(130, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:28:38'),
(131, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:28:38'),
(132, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:28:38'),
(133, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:28:39'),
(134, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2025-12-03 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:32:23'),
(135, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:32:23'),
(136, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:32:24'),
(137, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:32:24'),
(138, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:34:03'),
(139, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:34:04'),
(140, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:34:05'),
(141, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:34:05'),
(142, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:43:40'),
(143, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:43:41'),
(144, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-10 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:43:41'),
(145, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:43:41'),
(146, 1, 'bill_create_and_pay', 'Amount 800.00, Old expiry 2025-12-03, New expiry 2026-01-08', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:45:30'),
(147, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:46:45'),
(148, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:46:46'),
(149, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:46:46'),
(150, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:46:47'),
(151, 1, 'bill_create_and_pay', 'Amount 800.00, Old expiry 2025-12-02, New expiry 2026-01-08', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:46:50'),
(152, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:51:09'),
(153, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:51:09'),
(154, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:51:10'),
(155, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:51:10'),
(156, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:53:51'),
(157, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:53:52'),
(158, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2026-01-08 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:53:52'),
(159, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 15:53:53'),
(160, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-01-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 16:15:22'),
(161, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 16:15:22'),
(162, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-12 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 16:15:23'),
(163, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 16:15:23'),
(164, 1, 'user_disable', 'User \'rased\' disabled', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 16:15:29'),
(165, 1, 'Expiry updated', 'Updated expiry date for user \'atish\' from 2026-02-08 to 2025-12-03', 4, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 17:22:41'),
(166, 1, 'Expiry updated', 'Updated expiry date for user \'mahabub\' from 2026-01-08 to 2025-12-04', 3, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 17:22:41'),
(167, 1, 'Expiry updated', 'Updated expiry date for user \'rased2025\' from 2025-12-11 to 2025-12-01', 2, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 17:22:42'),
(168, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 17:22:42'),
(169, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-02 to 2025-12-02', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-08 17:22:43'),
(170, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-10 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 13:00:48'),
(171, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-19', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 13:49:07'),
(172, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-19 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 14:02:40'),
(173, 2, 'Package Created', 'Package \'Monthly-1000\' created (Price: 1000). Router: EKOTA-ACCESS-RT-2. Pool: packege-15mbps.', 4, 'packages', '::1', '0000-00-00', '2025-12-09 14:06:04'),
(174, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-02-08 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 15:34:19'),
(175, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2026-01-08 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 15:49:53'),
(176, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 15:51:21'),
(177, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 15:51:22'),
(178, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-19', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 15:51:35'),
(179, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-19 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:02:37'),
(180, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-19', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:04:12'),
(181, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-19 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:07:28'),
(182, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:09:05'),
(183, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:09:06'),
(184, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-18', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:09:31'),
(185, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-13', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:09:38'),
(186, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-18 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:09:41'),
(187, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-13 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:10:51'),
(188, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-13', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:11:57'),
(189, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-11', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:19:48'),
(190, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-13 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:20:12'),
(191, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-11 to 2025-12-19', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:21:03'),
(192, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-19 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:33:46'),
(193, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-19', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:34:08'),
(194, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:36:26'),
(195, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-19 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:44:27'),
(196, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-18', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 16:46:07'),
(197, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 17:08:23'),
(198, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-18 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 17:10:30'),
(199, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 17:12:19'),
(200, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 17:12:20'),
(201, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 11, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 17:13:12'),
(202, 1, 'Expiry updated', 'Updated expiry date for user \'rased\' from 2025-12-10 to 2025-12-10', 1, 'pppoe_users', '::1', '0000-00-00', '2025-12-09 17:13:13');

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

--
-- Table structure for table `advance_bills`
--

CREATE TABLE `advance_bills` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `month_year` varchar(7) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_date` datetime DEFAULT current_timestamp(),
  `used` tinyint(1) DEFAULT 0,
  `used_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `bills`
--

CREATE TABLE `bills` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `partial_paid_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `due_remaining` decimal(10,2) NOT NULL DEFAULT 0.00,
  `month_year` char(7) NOT NULL COMMENT 'YYYY-MM',
  `bill_start_date` date NOT NULL,
  `bill_end_date` date NOT NULL,
  `status` enum('0','1','2') DEFAULT '0' COMMENT '0=Unpaid, 1=Paid, 2=Partial',
  `due_date` date NOT NULL,
  `paid_at` datetime DEFAULT NULL,
  `created_date` date NOT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `paid_amount` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED
PARTITION BY RANGE (year(`created_date`) * 100 + month(`created_date`))
(
PARTITION p2025_12 VALUES LESS THAN (202601) ENGINE=InnoDB,
PARTITION p2026_01 VALUES LESS THAN (202602) ENGINE=InnoDB,
PARTITION p_future VALUES LESS THAN MAXVALUE ENGINE=InnoDB
);

--
-- Dumping data for table `bills`
--

INSERT INTO `bills` (`id`, `user_id`, `amount`, `partial_paid_amount`, `due_remaining`, `month_year`, `bill_start_date`, `bill_end_date`, `status`, `due_date`, `paid_at`, `created_date`, `created_at`, `paid_amount`) VALUES
(1, 1, 900.00, 0.00, 0.00, '2025-12', '0000-00-00', '0000-00-00', '', '2026-01-09', NULL, '2025-12-10', '2025-12-10 16:06:06', NULL),
(2, 2, 900.00, 0.00, 0.00, '2025-12', '0000-00-00', '0000-00-00', '', '2026-01-09', NULL, '2025-12-10', '2025-12-10 16:06:06', NULL),
(3, 3, 900.00, 0.00, 0.00, '2025-12', '0000-00-00', '0000-00-00', '', '2026-01-09', NULL, '2025-12-10', '2025-12-10 16:06:06', NULL),
(4, 4, 900.00, 0.00, 0.00, '2025-12', '0000-00-00', '0000-00-00', '', '2026-01-09', NULL, '2025-12-10', '2025-12-10 16:06:06', NULL),
(5, 5, 900.00, 0.00, 0.00, '2025-12', '0000-00-00', '0000-00-00', '', '2026-01-09', NULL, '2025-12-10', '2025-12-10 16:06:06', NULL);

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

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `full_name` varchar(100) DEFAULT NULL,
  `phone` varchar(15) DEFAULT NULL,
  `email` varchar(50) NOT NULL,
  `nid_number` varchar(20) DEFAULT NULL,
  `photo` varchar(200) DEFAULT NULL,
  `connection_type` enum('FTTH','Wireless','Home WiFi') DEFAULT NULL,
  `customer_category` enum('Home','Corporate','Shop','Office') DEFAULT NULL,
  `area` varchar(100) DEFAULT NULL,
  `road` varchar(100) DEFAULT NULL,
  `house` varchar(100) DEFAULT NULL,
  `remarks` varchar(255) NOT NULL,
  `olt_name` varchar(100) DEFAULT NULL,
  `pon_port` varchar(50) DEFAULT NULL,
  `onu_model` varchar(100) DEFAULT NULL,
  `onu_serial` varchar(100) DEFAULT NULL,
  `onu_signal` varchar(20) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED;

--
-- Dumping data for table `customers`
--

INSERT INTO `customers` (`id`, `user_id`, `full_name`, `phone`, `email`, `nid_number`, `photo`, `connection_type`, `customer_category`, `area`, `road`, `house`, `remarks`, `olt_name`, `pon_port`, `onu_model`, `onu_serial`, `onu_signal`, `created_at`, `updated_at`) VALUES
(1, 1, 'John Doe', '01712345678', 'john@email.com', '1234567890123', NULL, NULL, NULL, 'Mirpur', 'Road 12', 'House 45', 'New connection', NULL, NULL, NULL, NULL, NULL, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(2, 2, 'Jane Smith', '01898765432', 'jane@email.com', '9876543210987', NULL, NULL, NULL, 'Uttara', 'Road 5', 'House 23', 'Corporate client', NULL, NULL, NULL, NULL, NULL, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(3, 3, 'Bob Wilson', '01911223344', 'bob@email.com', '4567890123456', NULL, NULL, NULL, 'Dhanmondi', 'Road 27', 'House 8', 'Residential', NULL, NULL, NULL, NULL, NULL, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(4, 4, 'Alice Brown', '01655667788', 'alice@email.com', '7890123456789', NULL, NULL, NULL, 'Gulshan', 'Road 1', 'House 12', '', NULL, NULL, NULL, NULL, NULL, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(5, 5, 'Test User', '01500112233', '', '', NULL, NULL, NULL, 'Banani', '', '', 'Test account', NULL, NULL, NULL, NULL, NULL, '2025-12-10 10:06:06', '2025-12-10 10:06:06');

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

--
-- Table structure for table `dept_permission_defaults`
--

CREATE TABLE `dept_permission_defaults` (
  `id` int(10) UNSIGNED NOT NULL,
  `dept_role` varchar(50) NOT NULL,
  `permission_key` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `dept_permission_defaults`
--

INSERT INTO `dept_permission_defaults` (`id`, `dept_role`, `permission_key`) VALUES
(9, 'accounts', 'billing_pay'),
(10, 'accounts', 'billing_report'),
(8, 'accounts', 'billing_view'),
(7, 'noc', 'pppoe_live_traffic'),
(6, 'noc', 'pppoe_status'),
(5, 'noc', 'pppoe_view'),
(11, 'technical', 'bill_backdate_change'),
(2, 'technical', 'pppoe_enable_disable'),
(3, 'technical', 'pppoe_status'),
(1, 'technical', 'pppoe_view'),
(4, 'technical', 'router_monitoring');

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

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `bill_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `invoice_number` varchar(30) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `month_year` char(7) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `invoice_branding`
--

CREATE TABLE `invoice_branding` (
  `owner_id` int(10) UNSIGNED NOT NULL,
  `business_name` varchar(100) DEFAULT NULL,
  `logo` varchar(200) DEFAULT NULL,
  `address` varchar(200) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `mac_cache`
--

CREATE TABLE `mac_cache` (
  `oui` varchar(6) NOT NULL,
  `vendor` varchar(100) DEFAULT NULL,
  `device` varchar(100) DEFAULT NULL,
  `type` varchar(50) DEFAULT NULL,
  `source` varchar(50) DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `mac_cache`
--

INSERT INTO `mac_cache` (`oui`, `vendor`, `device`, `type`, `source`, `updated_at`) VALUES
('74DA88', 'TP-LINK TECHNOLOGIES CO.,LTD.', 'TP-LINK TECHNOLOGIES CO.,LTD. Device', 'Router', 'macvendors.com', '2025-12-03 11:05:01'),
('98254A', 'TP-Link Systems Inc', 'TP-Link Systems Inc Device', 'Router', 'macvendors.com', '2025-12-04 05:47:00');

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

--
-- Table structure for table `packages`
--

CREATE TABLE `packages` (
  `id` int(10) UNSIGNED NOT NULL,
  `router_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `remote_pool` varchar(100) NOT NULL,
  `price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `packages`
--

INSERT INTO `packages` (`id`, `router_id`, `name`, `remote_pool`, `price`, `created_at`, `updated_at`) VALUES
(1, 1, 'GPON-25-MBPS-800TK', 'GPON-25-MBPS-800TK', 800.00, '2025-12-02 14:22:37', '2025-12-02 14:22:37'),
(3, 1, 'GPON-30-MBPS-1000TK', 'GPON-30-MBPS-1000TK', 900.00, '2025-12-04 04:54:22', '2025-12-04 04:55:15'),
(4, 3, 'Monthly-1000', 'packege-15mbps', 1000.00, '2025-12-09 08:06:04', '2025-12-09 08:06:04');

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

--
-- Table structure for table `panel_users`
--

CREATE TABLE `panel_users` (
  `id` int(10) UNSIGNED NOT NULL,
  `email` varchar(100) NOT NULL,
  `password` varchar(255) NOT NULL,
  `name` varchar(100) NOT NULL,
  `company_name` varchar(200) DEFAULT NULL,
  `main_role` enum('superadmin','admin','reseller','subreseller') NOT NULL,
  `dept_role` enum('none','technical','noc','accounts','sales') DEFAULT 'none',
  `status` tinyint(1) DEFAULT 1 COMMENT '0=inactive, 1=active',
  `parent_id` int(10) UNSIGNED DEFAULT NULL,
  `phone` varchar(15) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `sms_permission` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `panel_users`
--

INSERT INTO `panel_users` (`id`, `email`, `password`, `name`, `company_name`, `main_role`, `dept_role`, `status`, `parent_id`, `phone`, `address`, `sms_permission`, `created_at`, `updated_at`) VALUES
(1, 'admin@gmail.com', 'admin', 'System Admin', NULL, 'superadmin', 'none', 1, NULL, NULL, NULL, 0, '2025-12-02 13:30:01', '2025-12-02 13:59:14'),
(2, 'tamim@gmail.com', '12', 'tamim', NULL, 'admin', 'none', 1, 1, NULL, NULL, 0, '2025-12-09 03:32:42', '2025-12-09 03:32:42');

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

--
-- Table structure for table `partial_payments`
--

CREATE TABLE `partial_payments` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `bill_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `days_paid` int(11) NOT NULL DEFAULT 0,
  `payment_date` date NOT NULL,
  `payment_method` varchar(50) DEFAULT 'cash',
  `notes` text DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `bill_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` varchar(50) DEFAULT 'full',
  `method` varchar(20) DEFAULT 'cash',
  `paid_date` date NOT NULL,
  `paid_at` datetime DEFAULT current_timestamp(),
  `days` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED
PARTITION BY RANGE (year(`paid_date`) * 100 + month(`paid_date`))
(
PARTITION p2025_12 VALUES LESS THAN (202601) ENGINE=InnoDB,
PARTITION p2026_01 VALUES LESS THAN (202602) ENGINE=InnoDB,
PARTITION p_future VALUES LESS THAN MAXVALUE ENGINE=InnoDB
);

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` (`id`, `bill_id`, `user_id`, `amount`, `payment_method`, `method`, `paid_date`, `paid_at`, `days`) VALUES
(1, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 09:49:17', 31),
(2, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 09:52:17', 31),
(3, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 09:52:26', 31),
(4, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 09:53:36', 31),
(5, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:01:50', 31),
(6, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:04:32', 31),
(7, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:05:05', 31),
(8, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:06:27', 31),
(9, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:07:08', 31),
(10, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:07:12', 31),
(11, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:07:23', 31),
(12, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:09:59', 31),
(13, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:11:20', 31),
(14, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:11:40', 31),
(15, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:11:54', 31),
(16, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:12:34', 31),
(17, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:13:29', 31),
(18, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:14:27', 31),
(19, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:15:24', 31),
(20, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:15:43', 31),
(21, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:16:24', 31),
(22, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:17:50', 31),
(23, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:18:13', 31),
(24, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:18:27', 31),
(25, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:19:18', 31),
(26, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:22:41', 31),
(27, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:23:00', 31),
(28, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:23:17', 31),
(29, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:24:19', 31),
(30, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:24:48', 31),
(31, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:25:25', 31),
(32, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:26:47', 31),
(33, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:32:23', 31),
(34, 5, 3, 77.42, 'full', 'cash', '0000-00-00', '2025-12-08 10:33:07', 3),
(35, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:33:41', 31),
(36, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:34:40', 31),
(37, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:38:02', 31),
(38, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:38:45', 31),
(39, 1, 2, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 10:39:12', 2),
(40, 3, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:41:03', 31),
(41, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:42:14', 31),
(42, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:45:03', 31),
(43, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:45:42', 31),
(44, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:47:24', 31),
(45, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:50:09', 31),
(46, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:53:02', 31),
(47, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:53:51', 31),
(48, 3, 2, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 10:54:00', 2),
(49, 4, 2, 206.45, 'full', 'cash', '0000-00-00', '2025-12-08 10:54:13', 8),
(50, 6, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:54:49', 31),
(51, 8, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:56:34', 31),
(52, 1, 1, 154.84, 'full', 'cash', '0000-00-00', '2025-12-08 10:57:01', 6),
(53, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:57:10', 31),
(54, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:57:16', 31),
(55, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:58:31', 31),
(56, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 10:59:11', 31),
(57, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 11:01:44', 31),
(58, 1, 1, 180.65, 'full', 'cash', '0000-00-00', '2025-12-08 11:02:35', 7),
(59, 2, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 11:03:06', 31),
(60, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 11:53:36', 31),
(61, 3, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 11:53:44', 31),
(62, 1, 1, 77.42, 'full', 'cash', '0000-00-00', '2025-12-08 11:54:40', 3),
(63, 3, 2, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 11:56:53', 2),
(64, 1, 1, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 12:38:14', 2),
(65, 3, 2, 77.42, 'full', 'cash', '0000-00-00', '2025-12-08 12:43:39', 3),
(66, 1, 1, 25.81, 'full', 'cash', '0000-00-00', '2025-12-08 12:44:20', 1),
(67, 3, 2, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 12:53:35', 2),
(68, 1, 1, 25.81, 'full', 'cash', '0000-00-00', '2025-12-08 12:54:29', 1),
(69, 2, 2, 232.26, 'full', 'cash', '0000-00-00', '2025-12-08 12:54:41', 9),
(70, 1, 1, 25.81, 'full', 'cash', '0000-00-00', '2025-12-08 12:54:52', 1),
(71, 1, 2, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 13:09:05', 2),
(72, 3, 1, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 13:28:41', 2),
(73, 5, 3, 258.06, 'full', 'cash', '0000-00-00', '2025-12-08 13:32:59', 10),
(74, 7, 4, 464.52, 'full', 'cash', '0000-00-00', '2025-12-08 13:33:25', 18),
(75, 1, 1, 77.42, 'full', 'cash', '0000-00-00', '2025-12-08 13:34:26', 3),
(76, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 13:34:49', 31),
(77, 1, 1, 25.81, 'full', 'cash', '0000-00-00', '2025-12-08 13:35:14', 1),
(78, 3, 2, 154.84, 'full', 'cash', '0000-00-00', '2025-12-08 13:37:33', 6),
(79, 5, 3, 283.87, 'full', 'cash', '0000-00-00', '2025-12-08 13:49:54', 11),
(80, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 13:56:27', 31),
(81, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 13:57:56', 31),
(82, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:10:57', 31),
(83, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:13:05', 31),
(84, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:15:49', 31),
(85, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:16:27', 31),
(86, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:17:00', 31),
(87, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:19:03', 31),
(88, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:20:08', 31),
(89, 1, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:22:37', 31),
(90, 3, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:27:32', 31),
(91, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:27:46', 31),
(92, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:31:26', 31),
(93, 2, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:31:31', 31),
(94, 3, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:31:35', 28),
(95, 4, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:31:39', 31),
(96, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:32:48', 31),
(97, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:43:50', 31),
(98, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:44:08', 31),
(99, 6, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:44:20', 31),
(100, 8, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:44:58', 31),
(101, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:46:37', 31),
(102, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 14:53:54', 31),
(103, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:14:26', 31),
(104, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:17:27', 31),
(106, 4, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:20:45', 31),
(107, 6, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:22:15', 31),
(108, 8, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:27:23', 31),
(109, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:28:50', 31),
(110, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:30:09', 31),
(111, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:31:41', 31),
(112, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:32:29', 31),
(113, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:32:38', 31),
(114, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:32:42', 31),
(115, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:33:54', 31),
(116, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:37:18', 31),
(117, 3, 2, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 15:37:33', 2),
(118, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:38:12', 31),
(119, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:42:37', 31),
(120, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:43:46', 31),
(121, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:44:58', 31),
(122, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:45:16', 31),
(123, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:45:29', 0),
(124, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:46:50', 0),
(125, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:48:15', 31),
(126, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:50:13', 31),
(127, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:50:36', 31),
(128, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:51:13', 31),
(129, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:51:49', 31),
(130, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:52:23', 31),
(131, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:53:30', 31),
(132, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:54:02', 31),
(133, 3, 2, 103.23, 'full', 'cash', '0000-00-00', '2025-12-08 15:54:09', 4),
(134, 5, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 15:54:25', 31),
(135, 7, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 16:15:10', 31),
(136, 1, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 16:15:30', 31),
(137, 3, 2, 77.42, 'full', 'cash', '0000-00-00', '2025-12-08 16:15:36', 3),
(138, 5, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 16:34:45', 31),
(139, 6, 4, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 17:21:40', 31),
(140, 8, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 17:21:47', 31),
(141, 1, 1, 51.61, 'full', 'cash', '0000-00-00', '2025-12-08 17:22:52', 2),
(142, 3, 2, 800.00, 'full', 'cash', '0000-00-00', '2025-12-08 17:22:56', 31),
(143, 2, 1, 800.00, 'full', 'cash', '0000-00-00', '2025-12-09 09:20:05', 31),
(144, 6, 3, 800.00, 'full', 'cash', '0000-00-00', '2025-12-09 09:22:04', 31),
(145, 7, 11, 1000.00, 'full', 'cash', '0000-00-00', '2025-12-09 15:26:21', 31);

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

--
-- Table structure for table `permissions_master`
--

CREATE TABLE `permissions_master` (
  `id` int(10) UNSIGNED NOT NULL,
  `permission_key` varchar(100) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `parent_group` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions_master`
--

INSERT INTO `permissions_master` (`id`, `permission_key`, `description`, `parent_group`) VALUES
(1, 'user_view', 'View Users', 'user'),
(2, 'user_create', 'Create Users', 'user'),
(3, 'user_edit', 'Edit Users', 'user'),
(4, 'user_delete', 'Delete Users', 'user'),
(5, 'user_block', 'Block Users', 'user'),
(6, 'user_unblock', 'Unblock Users', 'user'),
(7, 'pppoe_view', 'View PPPoE Users', 'pppoe'),
(8, 'pppoe_create', 'Create PPPoE User', 'pppoe'),
(9, 'pppoe_edit', 'Edit PPPoE User', 'pppoe'),
(10, 'pppoe_delete', 'Delete PPPoE User', 'pppoe'),
(11, 'pppoe_enable', 'Enable PPPoE', 'pppoe'),
(12, 'pppoe_disable', 'Disable PPPoE', 'pppoe'),
(13, 'pppoe_live_session_kill', 'Kill PPPoE Live Session', 'pppoe'),
(14, 'pppoe_reset_password', 'Reset PPPoE Password', 'pppoe'),
(15, 'bill_view', 'View Bills', 'bill'),
(16, 'bill_create', 'Create Bill', 'bill'),
(17, 'bill_edit', 'Edit Bill', 'bill'),
(18, 'bill_delete', 'Delete Bill', 'bill'),
(19, 'bill_backdate_change', 'Change Backdate', 'bill'),
(20, 'bill_expiry_extend', 'Extend Expiry Date', 'bill'),
(21, 'bill_discount_add', 'Add Bill Discount', 'bill'),
(22, 'bill_mark_paid', 'Mark Bill Paid', 'bill'),
(23, 'bill_mark_unpaid', 'Mark Bill Unpaid', 'bill'),
(24, 'bill_renew', 'Renew User', 'bill'),
(25, 'bill_next_month_pay', 'Pay Next Month', 'bill'),
(26, 'sms_access', 'Access SMS Module', 'sms'),
(27, 'sms_send_single', 'Send Single SMS', 'sms'),
(28, 'sms_send_bulk', 'Send Bulk SMS', 'sms'),
(29, 'sms_gateway_setup', 'Manage SMS Gateway', 'sms'),
(30, 'sms_template_manage', 'Manage SMS Template', 'sms'),
(31, 'sms_logs_view', 'View SMS Logs', 'sms'),
(32, 'invoice_view', 'View Invoice', 'invoice'),
(33, 'invoice_create', 'Create Invoice', 'invoice'),
(34, 'invoice_edit', 'Edit Invoice', 'invoice'),
(35, 'invoice_delete', 'Delete Invoice', 'invoice'),
(36, 'invoice_pdf_generate', 'Generate Invoice PDF', 'invoice'),
(37, 'accounts_view', 'View Accounts', 'accounts'),
(38, 'accounts_add_transaction', 'Add Transaction', 'accounts'),
(39, 'accounts_edit_transaction', 'Edit Transaction', 'accounts'),
(40, 'accounts_delete_transaction', 'Delete Transaction', 'accounts'),
(41, 'accounts_cash_in', 'Cash In', 'accounts'),
(42, 'accounts_cash_out', 'Cash Out', 'accounts'),
(43, 'accounts_report_view', 'View Account Report', 'accounts'),
(44, 'router_view', 'View Routers', 'router'),
(45, 'router_add', 'Add Router', 'router'),
(46, 'router_edit', 'Edit Router', 'router'),
(47, 'router_delete', 'Delete Router', 'router'),
(48, 'router_live_traffic', 'Live Traffic Monitor', 'router'),
(49, 'router_sync_pppoe', 'Sync PPPoE', 'router'),
(50, 'router_restart', 'Restart Router', 'router'),
(51, 'report_daily', 'Daily Report', 'report'),
(52, 'report_monthly', 'Monthly Report', 'report'),
(53, 'report_due_list', 'Due List', 'report'),
(54, 'report_expired_list', 'Expired List', 'report'),
(55, 'report_collection', 'Collection Report', 'report'),
(56, 'setting_general', 'General Settings', 'settings'),
(57, 'setting_sms', 'SMS Settings', 'settings'),
(58, 'setting_role_permission_manage', 'Manage Role Permissions', 'settings'),
(59, 'log_view', 'View Logs', 'logs');

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

--
-- Table structure for table `pppoe_status`
--

CREATE TABLE `pppoe_status` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(50) NOT NULL,
  `status` tinyint(1) DEFAULT 0 COMMENT '0=offline, 1=online',
  `uptime` varchar(100) DEFAULT NULL,
  `last_logged_out` varchar(100) DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `pppoe_users`
--

CREATE TABLE `pppoe_users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
  `router_id` int(10) UNSIGNED NOT NULL,
  `profile` varchar(50) NOT NULL,
  `expiry_date` date NOT NULL,
  `owner_id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(1) DEFAULT NULL,
  `permanent_status` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED;

--
-- Dumping data for table `pppoe_users`
--

INSERT INTO `pppoe_users` (`id`, `username`, `password`, `router_id`, `profile`, `expiry_date`, `owner_id`, `status`, `permanent_status`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 'john_doe', 'pass123', 1, 'GPON-30-MBPS-1000TK', '2026-01-09', 1, 1, 1, 1, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(2, 'jane_smith', 'pass456', 1, 'GPON-30-MBPS-1000TK', '2026-01-09', 1, 1, 1, 1, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(3, 'bob_wilson', 'pass789', 1, 'GPON-30-MBPS-1000TK', '2026-01-09', 1, 1, 1, 1, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(4, 'alice_brown', 'pass012', 1, 'GPON-30-MBPS-1000TK', '2026-01-09', 1, 1, 1, 1, '2025-12-10 10:06:06', '2025-12-10 10:06:06'),
(5, 'test_user', 'testpass', 1, 'GPON-30-MBPS-1000TK', '2026-01-09', 1, 1, 1, 1, '2025-12-10 10:06:06', '2025-12-10 10:06:06');

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

--
-- Table structure for table `pppoe_users_backup`
--

CREATE TABLE `pppoe_users_backup` (
  `id` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `router_id` int(10) UNSIGNED NOT NULL,
  `profile` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiry_date` date NOT NULL,
  `owner_id` int(10) UNSIGNED NOT NULL,
  `status` tinyint(1) DEFAULT NULL,
  `permanent_status` tinyint(1) NOT NULL DEFAULT 1,
  `created_by` int(10) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `backup_time` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `routers`
--

CREATE TABLE `routers` (
  `id` int(10) UNSIGNED NOT NULL,
  `owner_id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `ip` varchar(45) NOT NULL,
  `api_port` smallint(5) UNSIGNED DEFAULT 8728,
  `username` varchar(50) NOT NULL,
  `password` varchar(100) NOT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `routers`
--

INSERT INTO `routers` (`id`, `owner_id`, `name`, `ip`, `api_port`, `username`, `password`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 'PIEAL-VI-RT-ACCESS', '103.58.75.74', 7475, 'gFcL', 'gfcl321#gfcl', 1, '2025-12-02 14:08:31', '2025-12-02 14:11:36'),
(2, 1, 'PIEAL-VAI-RT-CORE', '103.58.74.140', 7474, 'gFcL', 'gfcl321#gfcl', 1, '2025-12-04 04:56:48', '2025-12-04 04:57:01'),
(3, 2, 'EKOTA-ACCESS-RT-2', '103.58.75.199', 8750, 'bNeT', 'n0c@BnEt!#', 1, '2025-12-09 08:04:25', '2025-12-09 08:04:25');

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

--
-- Table structure for table `sms_auto_rules`
--

CREATE TABLE `sms_auto_rules` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `owner_id` bigint(20) UNSIGNED NOT NULL,
  `create_template` int(11) DEFAULT NULL,
  `create_status` tinyint(1) DEFAULT 0,
  `create_masking` varchar(20) DEFAULT 'nonmask',
  `exp1_template` int(11) DEFAULT NULL,
  `exp2_template` int(11) DEFAULT NULL,
  `exp3_template` int(11) DEFAULT NULL,
  `exp_status` tinyint(1) DEFAULT 0,
  `exp_masking` varchar(20) DEFAULT 'nonmask',
  `today_exp_template` int(11) DEFAULT NULL,
  `today_exp_status` tinyint(1) DEFAULT 0,
  `today_exp_masking` varchar(20) DEFAULT 'nonmask',
  `pay_template` int(11) DEFAULT NULL,
  `pay_status` tinyint(1) DEFAULT 0,
  `pay_masking` varchar(20) DEFAULT 'nonmask',
  `due_online_template` int(11) DEFAULT NULL,
  `due_online_status` tinyint(1) DEFAULT 0,
  `due_online_masking` varchar(20) DEFAULT 'nonmask',
  `auto_due_template` int(11) DEFAULT NULL,
  `auto_due_status` tinyint(1) DEFAULT 0,
  `auto_due_masking` varchar(20) DEFAULT 'nonmask',
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `create_gateway` varchar(50) DEFAULT NULL,
  `exp_gateway` varchar(50) DEFAULT NULL,
  `today_exp_gateway` varchar(50) DEFAULT NULL,
  `pay_gateway` varchar(50) DEFAULT NULL,
  `due_online_gateway` varchar(50) DEFAULT NULL,
  `auto_due_gateway` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sms_auto_rules`
--

INSERT INTO `sms_auto_rules` (`id`, `owner_id`, `create_template`, `create_status`, `create_masking`, `exp1_template`, `exp2_template`, `exp3_template`, `exp_status`, `exp_masking`, `today_exp_template`, `today_exp_status`, `today_exp_masking`, `pay_template`, `pay_status`, `pay_masking`, `due_online_template`, `due_online_status`, `due_online_masking`, `auto_due_template`, `auto_due_status`, `auto_due_masking`, `updated_at`, `create_gateway`, `exp_gateway`, `today_exp_gateway`, `pay_gateway`, `due_online_gateway`, `auto_due_gateway`) VALUES
(1, 2, 0, 0, 'nonmask', 3, 3, 0, 1, 'nonmask', 0, 0, 'nonmask', 0, 0, 'nonmask', 0, 0, 'nonmask', 0, 0, 'nonmask', '2025-12-09 11:07:52', '', '1', '', '', '', ''),
(2, 1, 0, 0, 'nonmask', 2, 2, 0, 1, 'nonmask', 0, 0, 'nonmask', 0, 0, 'nonmask', 0, 0, 'nonmask', 0, 0, 'nonmask', '2025-12-09 11:13:29', '', '1', '', '', '', '');

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

--
-- Table structure for table `sms_gateways`
--

CREATE TABLE `sms_gateways` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) NOT NULL,
  `api_url` varchar(255) NOT NULL,
  `api_user` varchar(100) DEFAULT NULL,
  `api_pass` varchar(100) DEFAULT NULL,
  `sender_id` varchar(50) DEFAULT NULL,
  `type` enum('masking','non-masking') DEFAULT 'non-masking',
  `is_active` tinyint(1) DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sms_gateways`
--

INSERT INTO `sms_gateways` (`id`, `name`, `api_url`, `api_user`, `api_pass`, `sender_id`, `type`, `is_active`) VALUES
(1, 'smsbangladesh', 'https://panel2.smsbangladesh.com/api', 'greennetwork.isp@gmail.com', 'Mm8713@@', '', 'non-masking', 1);

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

--
-- Table structure for table `sms_gateway_assigned`
--

CREATE TABLE `sms_gateway_assigned` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `gateway_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sms_gateway_assigned`
--

INSERT INTO `sms_gateway_assigned` (`id`, `user_id`, `gateway_id`) VALUES
(1, 1, 1),
(2, 2, 1);

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

--
-- Table structure for table `sms_logs`
--

CREATE TABLE `sms_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `phone` varchar(15) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `masking` varchar(20) DEFAULT NULL,
  `status` varchar(50) DEFAULT NULL,
  `gateway_id` int(10) UNSIGNED DEFAULT NULL,
  `owner_id` int(10) UNSIGNED DEFAULT NULL,
  `ip` varchar(45) DEFAULT NULL,
  `log_date` date NOT NULL,
  `log_time` time DEFAULT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED
PARTITION BY RANGE (year(`log_date`) * 100 + month(`log_date`))
(
PARTITION p2025_12 VALUES LESS THAN (202601) ENGINE=InnoDB,
PARTITION p_future VALUES LESS THAN MAXVALUE ENGINE=InnoDB
);

--
-- Dumping data for table `sms_logs`
--

INSERT INTO `sms_logs` (`id`, `user_id`, `phone`, `message`, `masking`, `status`, `gateway_id`, `owner_id`, `ip`, `log_date`, `log_time`, `created_at`) VALUES
(1, 11, '01748934048', ', your bill 1,000 TK Tk expired.\r\nPlease pay immediately.', 'nonmask', 'success', 1, 1, '::1', '2025-12-09', '17:13:34', '2025-12-09 17:13:34'),
(2, 1, '01955511209', 'rased, bill 800 TK Tk due on 10/12/2025', 'nonmask', 'success', 1, 1, '::1', '2025-12-09', '17:13:36', '2025-12-09 17:13:36');

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

--
-- Table structure for table `sms_schedule`
--

CREATE TABLE `sms_schedule` (
  `id` int(10) UNSIGNED NOT NULL,
  `template_id` int(10) UNSIGNED DEFAULT NULL,
  `action` varchar(50) DEFAULT NULL,
  `send_to` varchar(50) DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `schedule_time` time DEFAULT NULL,
  `schedule_date` date DEFAULT NULL,
  `recurrence` varchar(20) DEFAULT 'once',
  `is_sent` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sms_templates`
--

CREATE TABLE `sms_templates` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `action` varchar(50) NOT NULL DEFAULT 'custom',
  `template` text DEFAULT NULL,
  `role` varchar(30) DEFAULT 'global',
  `reseller_id` int(10) UNSIGNED DEFAULT NULL,
  `user_id` int(10) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sms_templates`
--

INSERT INTO `sms_templates` (`id`, `name`, `action`, `template`, `role`, `reseller_id`, `user_id`, `created_at`) VALUES
(1, 'New User Created', 'New User Created', 'Welcome {name}, Internet Activated.\r\nUser: {username} Pass: {password}\r\nPackage: {package}', 'superadmin', NULL, NULL, '2025-12-09 10:48:31'),
(2, 'Due Reminder', 'Due Reminder', '{name}, bill {bill} Tk due on {due_date}', 'superadmin', NULL, NULL, '2025-12-09 10:48:50'),
(3, 'Bill Expired', 'expiry_alert', '{username}, your bill {bill} Tk expired.\r\nPlease pay immediately.', 'admin', 1, 2, '2025-12-09 10:50:11');

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

--
-- Table structure for table `temp_extend`
--

CREATE TABLE `temp_extend` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `extend_days` smallint(5) UNSIGNED NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `month_year` char(7) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `user_permissions`
--

CREATE TABLE `user_permissions` (
  `id` int(10) UNSIGNED NOT NULL,
  `user_id` int(10) UNSIGNED NOT NULL,
  `permission_key` varchar(100) NOT NULL,
  `allowed` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `user_permissions`
--

INSERT INTO `user_permissions` (`id`, `user_id`, `permission_key`, `allowed`) VALUES
(60, 2, 'accounts_view', 1),
(61, 2, 'accounts_add_transaction', 0),
(62, 2, 'accounts_edit_transaction', 0),
(63, 2, 'accounts_delete_transaction', 0),
(64, 2, 'accounts_cash_in', 0),
(65, 2, 'accounts_cash_out', 0),
(66, 2, 'accounts_report_view', 1),
(67, 2, 'bill_view', 1),
(68, 2, 'bill_create', 1),
(69, 2, 'bill_edit', 1),
(70, 2, 'bill_delete', 1),
(71, 2, 'bill_backdate_change', 1),
(72, 2, 'bill_expiry_extend', 1),
(73, 2, 'bill_discount_add', 1),
(74, 2, 'bill_mark_paid', 1),
(75, 2, 'bill_mark_unpaid', 1),
(76, 2, 'bill_renew', 1),
(77, 2, 'bill_next_month_pay', 1),
(78, 2, 'invoice_view', 1),
(79, 2, 'invoice_create', 0),
(80, 2, 'invoice_edit', 0),
(81, 2, 'invoice_delete', 0),
(82, 2, 'invoice_pdf_generate', 1),
(83, 2, 'log_view', 0),
(84, 2, 'pppoe_view', 1),
(85, 2, 'pppoe_create', 1),
(86, 2, 'pppoe_edit', 1),
(87, 2, 'pppoe_delete', 0),
(88, 2, 'pppoe_enable', 1),
(89, 2, 'pppoe_disable', 1),
(90, 2, 'pppoe_live_session_kill', 1),
(91, 2, 'pppoe_reset_password', 1),
(92, 2, 'report_daily', 1),
(93, 2, 'report_monthly', 0),
(94, 2, 'report_due_list', 1),
(95, 2, 'report_expired_list', 0),
(96, 2, 'report_collection', 0),
(97, 2, 'router_view', 1),
(98, 2, 'router_add', 0),
(99, 2, 'router_edit', 0),
(100, 2, 'router_delete', 0),
(101, 2, 'router_live_traffic', 1),
(102, 2, 'router_sync_pppoe', 0),
(103, 2, 'router_restart', 0),
(104, 2, 'setting_general', 1),
(105, 2, 'setting_sms', 1),
(106, 2, 'setting_role_permission_manage', 1),
(107, 2, 'sms_access', 1),
(108, 2, 'sms_send_single', 1),
(109, 2, 'sms_send_bulk', 1),
(110, 2, 'sms_gateway_setup', 0),
(111, 2, 'sms_template_manage', 0),
(112, 2, 'sms_logs_view', 0),
(113, 2, 'user_view', 1),
(114, 2, 'user_create', 1),
(115, 2, 'user_edit', 1),
(116, 2, 'user_delete', 0),
(117, 2, 'user_block', 1),
(118, 2, 'user_unblock', 1);

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

--
-- Table structure for table `user_traffic_logs`
--

CREATE TABLE `user_traffic_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `session_bytes_in` bigint(20) UNSIGNED DEFAULT 0,
  `session_bytes_out` bigint(20) UNSIGNED DEFAULT 0,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
PARTITION BY RANGE (year(`created_at`) * 100 + month(`created_at`))
(
PARTITION p2025_12 VALUES LESS THAN (202601) ENGINE=InnoDB,
PARTITION p_future VALUES LESS THAN MAXVALUE ENGINE=InnoDB
);

--
-- Dumping data for table `user_traffic_logs`
--

INSERT INTO `user_traffic_logs` (`id`, `user_id`, `session_bytes_in`, `session_bytes_out`, `created_at`, `updated_at`) VALUES
(1, 3, 69755092, 4378125989, '2025-12-03 00:00:00', '2025-12-03 12:31:44'),
(2, 3, 435904920, 15575770393, '2025-12-04 00:00:00', '2025-12-04 10:26:11'),
(3, 4, 985950787, 28492193433, '2025-12-04 00:00:00', '2025-12-04 09:02:58'),
(4, 1, 3153700, 180873364, '2025-12-08 00:00:00', '2025-12-08 03:49:13'),
(5, 3, 140463841, 6036824600, '2025-12-08 00:00:00', '2025-12-08 11:25:16');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `activity_logs`
--
ALTER TABLE `activity_logs`
  ADD PRIMARY KEY (`id`,`log_date`),
  ADD KEY `idx_user_action` (`user_id`,`action_type`),
  ADD KEY `idx_related` (`related_table`,`related_id`);

--
-- Indexes for table `advance_bills`
--
ALTER TABLE `advance_bills`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_user_month` (`user_id`,`month_year`),
  ADD KEY `idx_used` (`used`);

--
-- Indexes for table `bills`
--
ALTER TABLE `bills`
  ADD PRIMARY KEY (`id`,`created_date`),
  ADD KEY `idx_user_month` (`user_id`,`month_year`),
  ADD KEY `idx_status_due` (`status`,`due_date`),
  ADD KEY `idx_month_year` (`month_year`),
  ADD KEY `idx_owner_month_status` (`user_id`,`month_year`,`status`),
  ADD KEY `idx_user_dates` (`user_id`,`bill_start_date`,`bill_end_date`),
  ADD KEY `idx_bill_range` (`user_id`,`bill_start_date`,`bill_end_date`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_user_id` (`user_id`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_phone` (`phone`),
  ADD KEY `idx_area` (`area`),
  ADD KEY `idx_connection_type` (`connection_type`);

--
-- Indexes for table `dept_permission_defaults`
--
ALTER TABLE `dept_permission_defaults`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_dept_permission` (`dept_role`,`permission_key`);

--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `invoice_number` (`invoice_number`),
  ADD KEY `idx_bill_id` (`bill_id`),
  ADD KEY `idx_user_month` (`user_id`,`month_year`);

--
-- Indexes for table `invoice_branding`
--
ALTER TABLE `invoice_branding`
  ADD PRIMARY KEY (`owner_id`);

--
-- Indexes for table `mac_cache`
--
ALTER TABLE `mac_cache`
  ADD PRIMARY KEY (`oui`),
  ADD KEY `idx_updated` (`updated_at`);

--
-- Indexes for table `packages`
--
ALTER TABLE `packages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_router` (`router_id`),
  ADD KEY `idx_name` (`name`);

--
-- Indexes for table `panel_users`
--
ALTER TABLE `panel_users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email` (`email`),
  ADD KEY `idx_parent_status` (`parent_id`,`status`),
  ADD KEY `idx_role` (`main_role`,`dept_role`);

--
-- Indexes for table `partial_payments`
--
ALTER TABLE `partial_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `bill_id` (`bill_id`),
  ADD KEY `payment_date` (`payment_date`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`,`paid_date`),
  ADD KEY `idx_bill_id` (`bill_id`),
  ADD KEY `idx_user_date` (`user_id`,`paid_date`);

--
-- Indexes for table `permissions_master`
--
ALTER TABLE `permissions_master`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permission_key` (`permission_key`),
  ADD KEY `idx_group` (`parent_group`);

--
-- Indexes for table `pppoe_status`
--
ALTER TABLE `pppoe_status`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_id` (`user_id`),
  ADD KEY `idx_status` (`status`);

--
-- Indexes for table `pppoe_users`
--
ALTER TABLE `pppoe_users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_user_owner` (`username`,`owner_id`),
  ADD UNIQUE KEY `unique_username_per_owner` (`username`,`owner_id`),
  ADD KEY `idx_router_owner` (`router_id`,`owner_id`),
  ADD KEY `idx_expiry_status` (`expiry_date`,`status`),
  ADD KEY `idx_owner_status` (`owner_id`,`status`),
  ADD KEY `idx_created_at` (`created_at`),
  ADD KEY `idx_username_status` (`username`,`status`),
  ADD KEY `idx_expiry_owner` (`expiry_date`,`owner_id`);

--
-- Indexes for table `routers`
--
ALTER TABLE `routers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_owner_status` (`owner_id`,`status`),
  ADD KEY `idx_ip` (`ip`);

--
-- Indexes for table `sms_auto_rules`
--
ALTER TABLE `sms_auto_rules`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_owner` (`owner_id`);

--
-- Indexes for table `sms_gateways`
--
ALTER TABLE `sms_gateways`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_active` (`is_active`);

--
-- Indexes for table `sms_gateway_assigned`
--
ALTER TABLE `sms_gateway_assigned`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_user_gateway` (`user_id`,`gateway_id`);

--
-- Indexes for table `sms_logs`
--
ALTER TABLE `sms_logs`
  ADD PRIMARY KEY (`id`,`log_date`),
  ADD KEY `idx_user_id` (`user_id`),
  ADD KEY `idx_phone` (`phone`),
  ADD KEY `idx_owner_date` (`owner_id`,`log_date`);

--
-- Indexes for table `sms_schedule`
--
ALTER TABLE `sms_schedule`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_schedule_date` (`schedule_date`,`is_sent`);

--
-- Indexes for table `sms_templates`
--
ALTER TABLE `sms_templates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_action` (`action`),
  ADD KEY `idx_reseller` (`reseller_id`);

--
-- Indexes for table `temp_extend`
--
ALTER TABLE `temp_extend`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_user_month` (`user_id`,`month_year`),
  ADD KEY `idx_end_date` (`end_date`);

--
-- Indexes for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uk_user_permission` (`user_id`,`permission_key`),
  ADD KEY `idx_user` (`user_id`);

--
-- Indexes for table `user_traffic_logs`
--
ALTER TABLE `user_traffic_logs`
  ADD PRIMARY KEY (`id`,`created_at`),
  ADD KEY `idx_user_date` (`user_id`,`created_at`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `activity_logs`
--
ALTER TABLE `activity_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=203;

--
-- AUTO_INCREMENT for table `advance_bills`
--
ALTER TABLE `advance_bills`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `bills`
--
ALTER TABLE `bills`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `dept_permission_defaults`
--
ALTER TABLE `dept_permission_defaults`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `packages`
--
ALTER TABLE `packages`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `panel_users`
--
ALTER TABLE `panel_users`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `partial_payments`
--
ALTER TABLE `partial_payments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=146;

--
-- AUTO_INCREMENT for table `permissions_master`
--
ALTER TABLE `permissions_master`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;

--
-- AUTO_INCREMENT for table `pppoe_status`
--
ALTER TABLE `pppoe_status`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pppoe_users`
--
ALTER TABLE `pppoe_users`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `routers`
--
ALTER TABLE `routers`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `sms_auto_rules`
--
ALTER TABLE `sms_auto_rules`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `sms_gateways`
--
ALTER TABLE `sms_gateways`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `sms_gateway_assigned`
--
ALTER TABLE `sms_gateway_assigned`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `sms_logs`
--
ALTER TABLE `sms_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `sms_schedule`
--
ALTER TABLE `sms_schedule`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `sms_templates`
--
ALTER TABLE `sms_templates`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `temp_extend`
--
ALTER TABLE `temp_extend`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_permissions`
--
ALTER TABLE `user_permissions`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=119;

--
-- AUTO_INCREMENT for table `user_traffic_logs`
--
ALTER TABLE `user_traffic_logs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
