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

START TRANSACTION;



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

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `name`) VALUES
(5, 'Cakes'),
(6, 'Pastries');

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

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `id` int(11) NOT NULL,
  `subtotal` decimal(12,2) NOT NULL,
  `vat` decimal(12,2) NOT NULL,
  `discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(12,2) NOT NULL,
  `payment_method` varchar(20) NOT NULL,
  `cash_received` decimal(12,2) DEFAULT 0.00,
  `card_ref` varchar(100) DEFAULT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`id`, `subtotal`, `vat`, `discount`, `total`, `payment_method`, `cash_received`, `card_ref`, `created_at`) VALUES
(1, 700.00, 84.00, 120.00, 664.00, '0', 1000.00, NULL, '2025-08-07 22:09:05'),
(2, 20.00, 2.40, 0.00, 22.40, '0', 212121.00, NULL, '2025-08-07 22:19:57'),
(3, 20.00, 2.40, 0.00, 22.40, '0', 211.00, NULL, '2025-08-07 22:25:34'),
(4, 700.00, 84.00, 0.00, 784.00, '0', 1000.00, NULL, '2025-08-07 22:35:11'),
(5, 700.00, 84.00, 10.00, 774.00, '0', 1000.00, NULL, '2025-08-08 07:36:23'),
(6, 20.00, 2.40, 0.00, 22.40, '0', 100.00, NULL, '2025-08-08 08:01:32'),
(7, 720.00, 86.40, 0.00, 806.40, '0', 1000.00, NULL, '2025-08-08 08:09:19'),
(8, 20.00, 2.40, 0.00, 22.40, '0', 100.00, NULL, '2025-08-08 08:09:45'),
(9, 700.00, 84.00, 0.00, 784.00, '0', 800.00, NULL, '2025-08-08 08:10:04'),
(10, 700.00, 84.00, 0.00, 784.00, '0', 7000.00, NULL, '2025-08-08 08:10:44'),
(11, 20.00, 2.40, 0.00, 22.40, '0', 100.00, NULL, '2025-08-08 08:12:25'),
(12, 500.00, 60.00, 0.00, 560.00, '0', 569.00, NULL, '2025-08-08 18:51:41'),
(13, 775.00, 15.50, 0.00, 790.50, '0', 1000.00, NULL, '2025-08-28 19:13:51'),
(14, 2100.00, 21.00, 0.00, 2121.00, '0', 2121.00, NULL, '2025-08-28 19:24:19'),
(15, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:26:18'),
(16, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:26:31'),
(17, 1400.00, 0.00, 0.00, 1400.00, '0', 1499.00, NULL, '2025-08-28 19:27:37'),
(18, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:33:00'),
(19, 700.00, 0.00, 0.00, 700.00, '0', 53434.00, NULL, '2025-08-28 19:35:22'),
(20, 700.00, 140.00, 22222.00, 0.00, '0', 0.00, NULL, '2025-08-28 19:38:48'),
(21, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:41:12'),
(22, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:42:53'),
(23, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:44:51'),
(24, 700.00, 0.00, 0.00, 700.00, '0', 700.00, NULL, '2025-08-28 19:50:21'),
(25, 1405.00, 70.25, 0.00, 1475.25, '0', 2000.00, NULL, '2025-08-29 21:51:12'),
(26, 700.00, 0.00, 0.00, 700.00, '0', 0.00, NULL, '2025-09-11 16:58:42'),
(27, 510.00, 0.00, 0.00, 510.00, '0', 510.00, NULL, '2025-09-27 06:42:31'),
(28, 510.00, 0.00, 0.00, 510.00, '0', 1000.00, NULL, '2025-09-27 06:44:04'),
(29, 540.00, 0.00, 0.00, 540.00, '0', 600.00, NULL, '2025-09-27 06:48:29'),
(30, 530.00, 0.00, 0.00, 530.00, '0', 530.00, NULL, '2025-09-27 06:49:03'),
(31, 20.00, 0.00, 0.00, 20.00, '0', 100.00, NULL, '2025-09-27 06:49:20'),
(32, 20.00, 0.00, 0.00, 20.00, '0', 100.00, NULL, '2025-09-27 06:49:39'),
(33, 500.00, 0.00, 0.00, 500.00, '0', 1000.00, NULL, '2025-09-27 06:53:27'),
(34, 20.00, 0.00, 0.00, 20.00, '0', 200.00, NULL, '2025-09-27 06:54:04'),
(35, 500.00, 0.00, 0.00, 500.00, '0', 2008.00, NULL, '2025-09-27 06:56:00'),
(36, 10.00, 0.00, 0.00, 10.00, '0', 10.00, NULL, '2025-09-27 06:58:05'),
(37, 500.00, 25.00, 22.00, 503.00, '0', 503.00, NULL, '2025-09-27 07:00:21'),
(38, 500.00, 0.00, 0.00, 500.00, '0', 500.00, NULL, '2025-09-27 07:01:51'),
(39, 50.00, 0.00, 0.00, 50.00, '0', 50.00, NULL, '2025-09-27 07:05:11'),
(40, 20.00, 0.00, 0.00, 20.00, '0', 20.00, NULL, '2025-09-27 17:24:48'),
(41, 1760.00, 0.00, 5.00, 1755.00, '0', 2000.00, NULL, '2025-09-28 04:26:04'),
(42, 510.00, 0.00, 0.00, 510.00, '0', 2000.00, NULL, '2025-09-28 05:00:25'),
(43, 20.00, 0.00, 0.00, 20.00, '0', 100.00, NULL, '2025-09-28 05:00:55'),
(44, 187.50, 0.00, 0.00, 187.50, '0', 200.00, NULL, '2025-09-28 05:23:42'),
(45, 100.00, 0.00, 0.00, 100.00, '0', 100.00, NULL, '2025-09-28 05:29:14'),
(46, 1750.00, 0.00, 0.00, 1750.00, '0', 1750.00, NULL, '2025-09-28 05:33:55'),
(47, 562.50, 0.00, 0.00, 562.50, '0', 1000.00, NULL, '2025-09-30 18:18:37'),
(48, 10.00, 0.00, 0.00, 10.00, '0', 10.00, NULL, '2025-10-08 05:14:44'),
(49, 500.00, 0.00, 0.00, 500.00, '0', 500.00, NULL, '2025-10-08 05:20:33'),
(50, 500.00, 20.00, 0.00, 520.00, '0', 520.00, NULL, '2025-10-08 05:21:25'),
(51, 20.00, 1.00, 0.00, 21.00, '0', 21.00, NULL, '2025-10-08 05:50:32');

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

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (
  `id` int(11) NOT NULL,
  `order_id` int(11) NOT NULL,
  `product_id` int(11) DEFAULT NULL,
  `product_name` varchar(255) DEFAULT NULL,
  `price` decimal(12,2) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `total_price` decimal(12,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `order_items`
--

INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `price`, `qty`, `total_price`) VALUES
(1, 1, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(2, 2, 5, 'Croissants', 20.00, 1, 20.00),
(3, 3, 5, 'Croissants', 20.00, 1, 20.00),
(4, 4, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(5, 5, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(6, 6, 5, 'Croissants', 20.00, 1, 20.00),
(7, 7, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(8, 7, 5, 'Croissants', 20.00, 1, 20.00),
(9, 8, 5, 'Croissants', 20.00, 1, 20.00),
(10, 9, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(11, 10, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(12, 11, 5, 'Croissants', 20.00, 1, 20.00),
(13, 12, 5, 'Croissants', 20.00, 25, 500.00),
(14, 13, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(15, 13, 5, 'Croissants', 20.00, 3, 60.00),
(16, 13, 6, 'Pandesal', 5.00, 3, 15.00),
(17, 14, 4, 'Strawberry Match Cake', 700.00, 3, 2100.00),
(18, 15, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(19, 16, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(20, 17, 4, 'Strawberry Match Cake', 700.00, 2, 1400.00),
(21, 18, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(22, 19, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(23, 20, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(24, 21, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(25, 22, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(26, 23, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(27, 24, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(28, 25, 4, 'Strawberry Match Cake', 700.00, 2, 1400.00),
(29, 25, 6, 'Pandesal', 5.00, 1, 5.00),
(30, 26, 4, 'Strawberry Match Cake', 700.00, 1, 700.00),
(31, 27, 6, 'Pandesal', 10.00, 1, 10.00),
(32, 27, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(33, 28, 6, 'Pandesal', 10.00, 1, 10.00),
(34, 28, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(35, 29, 6, 'Pandesal', 10.00, 4, 40.00),
(36, 29, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(37, 30, 6, 'Pandesal', 10.00, 3, 30.00),
(38, 30, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(39, 31, 5, 'Croissants', 20.00, 1, 20.00),
(40, 32, 5, 'Croissants', 20.00, 1, 20.00),
(41, 33, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(42, 34, 5, 'Croissants', 20.00, 1, 20.00),
(43, 35, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(44, 36, 6, 'Pandesal', 10.00, 1, 10.00),
(45, 37, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(46, 38, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(47, 39, 5, 'Croissants', 20.00, 2, 40.00),
(48, 39, 6, 'Pandesal', 10.00, 1, 10.00),
(49, 40, 5, 'Croissants', 20.00, 1, 20.00),
(50, 41, 5, 'Croissants', 20.00, 3, 60.00),
(51, 41, 6, 'Pandesal', 10.00, 20, 200.00),
(52, 41, 8, 'Strawberry Match Cake', 500.00, 3, 1500.00),
(53, 42, 6, 'Pandesal', 10.00, 1, 10.00),
(54, 42, 8, 'Strawberry Match Cake', 500.00, 1, 500.00),
(55, 43, 5, 'Croissants', 20.00, 1, 20.00),
(56, 44, 8, 'Strawberry Match Cake', 62.00, 3, 187.50),
(57, 45, 8, 'Strawberry Match Cake', 100.00, 1, 100.00),
(58, 46, 8, 'Strawberry Match Cake', 500.00, 3, 1500.00),
(59, 46, 8, 'Strawberry Match Cake', 62.00, 4, 250.00),
(60, 47, 8, 'Strawberry Match', 62.00, 1, 62.50),
(61, 47, 8, 'Strawberry Match', 500.00, 1, 500.00),
(62, 48, 6, 'Pandesal', 10.00, 1, 10.00),
(63, 49, 8, 'Strawberry Match', 500.00, 1, 500.00),
(64, 50, 8, 'Strawberry Match', 500.00, 1, 500.00),
(65, 51, 5, 'Croissants', 20.00, 1, 20.00);

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

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `price` varchar(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `image` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`id`, `name`, `price`, `category_id`, `image`, `created_at`) VALUES
(5, 'Croissants', '20', 6, 'uploads/1754630789_images (10).jpg', '2025-08-08 05:26:29'),
(6, 'Pandesal', '10', 6, 'uploads/1758982265_download (4).jpg', '2025-08-09 02:45:51'),
(8, 'Strawberry Match', '500', 5, 'uploads/1758982385_BW1A4089-2.jpg', '2025-09-27 14:13:05');

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

--
-- Table structure for table `vat_settings`
--

CREATE TABLE `vat_settings` (
  `id` int(11) NOT NULL,
  `vat_rate` decimal(5,2) NOT NULL DEFAULT 12.00,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vat_settings`
--

INSERT INTO `vat_settings` (`id`, `vat_rate`, `is_active`, `created_at`) VALUES
(1, 5.00, 1, '2025-10-08 13:33:15');

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

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

--
-- Indexes for table `order_items`
--
ALTER TABLE `order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `order_id` (`order_id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `category_id` (`category_id`);

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `order_items`
--
ALTER TABLE `order_items`
  ADD CONSTRAINT `order_items_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;
COMMIT;

