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

START TRANSACTION;



--
-- Database: `mis_invoice_generator`
--

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

--
-- Table structure for table `bank_details`
--

CREATE TABLE `bank_details` (
  `id` int(11) NOT NULL,
  `account_number` varchar(255) NOT NULL,
  `bank_name` varchar(255) NOT NULL,
  `bank_address` varchar(255) NOT NULL,
  `swift_code` varchar(255) DEFAULT NULL,
  `ifsc_code` varchar(255) DEFAULT NULL,
  `wire_charges` varchar(255) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `bank_details`
--

INSERT INTO `bank_details` (`id`, `account_number`, `bank_name`, `bank_address`, `swift_code`, `ifsc_code`, `wire_charges`) VALUES
(1, '1234123412', 'ABC Bank', 'Ground Floor, Embassy Tower, Plot No.1-A  Indore,(M.P)-\nINDIA 452005', 'XXSWIFCO', 'IFSCXXX', 'On Client side');

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

--
-- Table structure for table `company`
--

CREATE TABLE `company` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `address` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `contact` varchar(255) NOT NULL,
  `admin_name` varchar(255) DEFAULT NULL,
  `admin_department` varchar(255) DEFAULT NULL,
  `company_logo` varchar(255) DEFAULT NULL,
  `hsn_sac` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `company`
--

INSERT INTO `company` (`id`, `name`, `address`, `email`, `contact`, `admin_name`, `admin_department`, `company_logo`, `hsn_sac`) VALUES
(1, 'Mango IT Solutions', '15/3, Old Palasia, Behind Sarda House, Indore 452 001 India', 'Matt@yourdomain.com', '+91-731-4044117 / 4046693', 'MangoIT Accounts', 'Billing Department, Mango It Solutions', 'uploads/1749808017520-logo_6.png', '998314');

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

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

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `invoice_number` varchar(255) NOT NULL,
  `user_id` int(11) NOT NULL,
  `client_name` varchar(255) NOT NULL,
  `client_company_name` varchar(255) DEFAULT NULL,
  `client_address` varchar(255) NOT NULL,
  `client_email` varchar(255) NOT NULL,
  `invoice_date` date NOT NULL,
  `period` varchar(255) DEFAULT NULL,
  `term` varchar(255) DEFAULT NULL,
  `project_code` varchar(255) DEFAULT NULL,
  `subtotal` decimal(10,2) DEFAULT 0.00,
  `payment_charges` decimal(10,2) DEFAULT 0.00,
  `total` decimal(10,2) DEFAULT 0.00,
  `status` enum('draft','sent','paid') DEFAULT 'draft',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `invoices`
--

INSERT INTO `invoices` (`id`, `invoice_number`, `user_id`, `client_name`, `client_company_name`, `client_address`, `client_email`, `invoice_date`, `period`, `term`, `project_code`, `subtotal`, `payment_charges`, `total`, `status`, `created_at`) VALUES
(147, '2018', 1, 'clientname', '', 'client addesss is indore', 'john@xxx.com', '2025-06-19', 'june 2024', NULL, 'up-09-2025', NULL, NULL, NULL, NULL, '2025-06-19 12:44:06'),
(148, '2019', 1, 'john right', '', '123 limbodi', 'xx@ss.com', '2025-06-19', 'june 2024', NULL, 'up-33-393', NULL, NULL, NULL, NULL, '2025-06-19 12:48:57'),
(149, '2020', 1, 'ddd', '', 'eeee', 'xx@xxx.com', '2025-06-19', 'jun', NULL, 'up-33-3333', NULL, NULL, NULL, NULL, '2025-06-19 12:55:26'),
(150, '2021', 1, 'john holding', '', 'level 12, pinnacle business tower, , 48grantham avenue, , london, , uk', 'john@youremail.com', '2025-06-19', '8/1/2025 - 8/31/2025', NULL, 'up-med-1074', NULL, NULL, NULL, NULL, '2025-06-19 13:04:21'),
(151, '2022', 1, 'john right', '', '123, new york city, indore', 'john@youremail.com', '2025-06-19', '7/1/2025 - 7/31/2025', NULL, 'up-joh-2024', 1000.00, NULL, 1009.00, NULL, '2025-06-19 13:17:09'),
(152, '2023', 1, 'John Holding', '', 'Level 12, Pinnacle Business Tower, , 48grantham Avenue, , London, , United State', 'john@youremail.com', '2025-06-19', '7/1/2025 - 7/31/2025', NULL, 'up-med-1074', 900.00, NULL, 908.00, NULL, '2025-06-19 13:26:12'),
(153, '2024', 1, 'David John', '', '234, New York City, Indore', 'david@youremail.com', '2025-06-19', '7/1/2025 - 7/31/2025', NULL, 'up-dav-2025', 45000.00, NULL, 45000.00, NULL, '2025-06-19 13:32:18'),
(154, '2025', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-20', '6/1/2025 - 6/30/2025', 'On Receipt', 'UP-MED-1074', 0.00, 35.00, 35.00, 'draft', '2025-06-20 05:25:19'),
(155, '2026', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-20', '6/1/2025 - 6/30/2025', 'test', 'UP-MED-1074', 0.00, 35.00, 35.00, 'draft', '2025-06-20 08:46:23'),
(156, '2027', 1, 'Mr. Andras Gaal', 'MTO Solutions kft', 'Hungry-Budapest 1036 Arpad fejedelem utja 53. 3em.2.', 'ashish@mangoitsolutions.com', '2025-06-20', '6/1/2025 - 6/30/2025', 'ttttt', 'UP-AND-1073', 0.00, 35.00, 35.00, 'draft', '2025-06-20 08:50:28'),
(157, '2028', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-20', '5/1/2025 - 5/31/2025', 'On Receipt', 'UP-MED-1074', 1750.00, 35.00, 1785.00, 'draft', '2025-06-20 08:59:06'),
(158, '2029', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-20', '6/1/2025 - 6/30/2025', 'test', 'UP-MED-1074', 0.00, 35.00, 35.00, 'draft', '2025-06-20 09:13:42'),
(159, '2030', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-20', '6/1/2025 - 6/30/2025', 'test', 'UP-MED-1074', 0.00, 35.00, 35.00, 'draft', '2025-06-20 09:14:21'),
(160, '2031', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-23', '', 'On receipt', 'UP-MED-1074', 60.00, 0.00, 60.00, 'sent', '2025-06-23 04:43:40'),
(161, '2032', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-23', '', 'On receipt', 'UP-MED-1074', 3600.00, 0.00, 3600.00, 'sent', '2025-06-23 04:51:14'),
(162, '2033', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-23', '', 'On receipt', 'UP-MED-1074', 14652.00, 0.00, 14652.00, 'sent', '2025-06-23 05:03:06'),
(163, '2034', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-23', '', 'On receipt', 'UP-MED-1074', 88.00, 0.00, 88.00, 'sent', '2025-06-23 05:16:45'),
(164, '2035', 1, 'Mr. Andras Gaal', 'MTO Solutions kft', 'Hungry-Budapest 1036 Arpad fejedelem utja 53. 3em.2.', 'ashish@mangoitsolutions.com', '2025-06-23', '', 'On receipt', 'UP-AND-1073', 968.00, 0.00, 968.00, 'sent', '2025-06-23 05:27:16'),
(165, '2036', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-23', '01-Jul-2025 to 31-Jul-2025,', 'On receipt', 'UP-MED-1074', 835.00, 35.00, 870.00, 'sent', '2025-06-23 06:01:41'),
(166, '2037', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-23', '1-July-2025 to 30-Jul-2025', 'On receipt', 'UP-MED-1074', 1452.00, 35.00, 1487.00, 'sent', '2025-06-23 06:09:05'),
(167, '2038', 1, 'John Streenan', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'john@youremail.com', '2025-06-25', '6/1/2025 - 6/30/2025', 'On Receipt', 'UP-MED-1074', 0.00, 35.00, 35.00, 'draft', '2025-06-25 10:49:53');

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

--
-- Table structure for table `invoice_config`
--

CREATE TABLE `invoice_config` (
  `id` int(11) NOT NULL,
  `starting_number` int(11) NOT NULL,
  `current_number` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `invoice_config`
--

INSERT INTO `invoice_config` (`id`, `starting_number`, `current_number`) VALUES
(1, 2005, 2039);

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

--
-- Table structure for table `invoice_items`
--

CREATE TABLE `invoice_items` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `description` text NOT NULL,
  `base_rate` decimal(10,2) NOT NULL,
  `unit` decimal(10,2) NOT NULL,
  `amount` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `invoice_items`
--

INSERT INTO `invoice_items` (`id`, `invoice_id`, `description`, `base_rate`, `unit`, `amount`) VALUES
(161, 149, 'development', 333.00, 333.00, 110889.00),
(162, 150, 'development of b2b website- milestone 3', 800.00, 1.00, 800.00),
(163, 150, 'development of b2b website: additional hours', 15.00, 42.00, 630.00),
(164, 151, 'development of b2b website- milestone 3', 20.00, 50.00, 1000.00),
(165, 152, 'Development Of B2b Website- Milestone 3', 900.00, 1.00, 900.00),
(166, 153, 'Development Of B2b Website- Milestone 3', 900.00, 50.00, 45000.00),
(167, 154, 'test', 0.00, 1.00, 0.00),
(168, 155, 'test', 0.00, 1.00, 0.00),
(169, 156, 'ttttt', 0.00, 1.00, 0.00),
(170, 157, 'Development of B2B Website - Milestone 3', 900.00, 1.00, 900.00),
(171, 157, 'Development of B2B Website: Additional hours', 10.00, 85.00, 850.00),
(172, 158, 'test', 0.00, 1.00, 0.00),
(173, 159, 'test', 0.00, 1.00, 0.00),
(174, 160, 'Development phase 1', 30.00, 2.00, 60.00),
(175, 161, 'Development phase 1', 900.00, 4.00, 3600.00),
(176, 162, 'Developement phase 2', 444.00, 33.00, 14652.00),
(177, 163, 'Development phase 2', 22.00, 4.00, 88.00),
(178, 164, 'Product help document', 44.00, 22.00, 968.00),
(179, 165, 'development phase 1', 400.00, 2.00, 800.00),
(180, 165, 'Payment transfer charges', 35.00, 1.00, 35.00),
(181, 166, 'Development phase 2', 44.00, 33.00, 1452.00),
(182, 167, 'test', 0.00, 1.00, 0.00);

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

--
-- Table structure for table `projects_details`
--

CREATE TABLE `projects_details` (
  `project_id` int(11) NOT NULL,
  `project_code` varchar(255) NOT NULL,
  `company_name` varchar(255) NOT NULL,
  `address` varchar(255) NOT NULL,
  `client_name` varchar(255) NOT NULL,
  `client_email` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `projects_details`
--

INSERT INTO `projects_details` (`project_id`, `project_code`, `company_name`, `address`, `client_name`, `client_email`) VALUES
(1, 'UP-AND-1073', 'MTO Solutions kft', 'Hungry-Budapest 1036 Arpad fejedelem utja 53. 3em.2.', 'Mr. Andras Gaal', 'ashish@mangoitsolutions.com'),
(2, 'UP-MED-1074', 'John Holding', 'John Holding Ltd.\r\nLevel 12, Pinnacle Business Tower\r\n48 Grantham Avenue\r\nLondon\r\nUnited State', 'John Streenan', 'john@youremail.com');

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

--
-- Table structure for table `recurring_invoices`
--

CREATE TABLE `recurring_invoices` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `next_run` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `recurring_invoices`
--

INSERT INTO `recurring_invoices` (`id`, `invoice_id`, `next_run`) VALUES
(1, 160, '2025-07-23'),
(2, 161, '2025-07-23'),
(3, 162, '2025-07-23'),
(4, 163, '2025-07-23'),
(5, 164, '2025-07-23'),
(6, 165, '2025-07-23'),
(7, 166, '2025-07-23');

--
-- Indexes for dumped tables
--

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

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

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

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

--
-- Indexes for table `invoice_items`
--
ALTER TABLE `invoice_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_id` (`invoice_id`);

--
-- Indexes for table `projects_details`
--
ALTER TABLE `projects_details`
  ADD PRIMARY KEY (`project_id`);

--
-- Indexes for table `recurring_invoices`
--
ALTER TABLE `recurring_invoices`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_id` (`invoice_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `bank_details`
--
ALTER TABLE `bank_details`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `company`
--
ALTER TABLE `company`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=168;

--
-- AUTO_INCREMENT for table `invoice_config`
--
ALTER TABLE `invoice_config`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `invoice_items`
--
ALTER TABLE `invoice_items`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=183;

--
-- AUTO_INCREMENT for table `projects_details`
--
ALTER TABLE `projects_details`
  MODIFY `project_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `recurring_invoices`
--
ALTER TABLE `recurring_invoices`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `invoice_items`
--
ALTER TABLE `invoice_items`
  ADD CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `recurring_invoices`
--
ALTER TABLE `recurring_invoices`
  ADD CONSTRAINT `recurring_invoices_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;
COMMIT;

