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

START TRANSACTION;



--
-- Database: `yyrzyzkt_db`
--

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

--
-- Table structure for table `bank_deposits`
--

CREATE TABLE `bank_deposits` (
  `id` int NOT NULL,
  `staff_id` int NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','transfer') NOT NULL,
  `bank_name` varchar(100) DEFAULT NULL,
  `deposit_date` date NOT NULL,
  `notes` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `bank_deposits`
--

INSERT INTO `bank_deposits` (`id`, `staff_id`, `amount`, `payment_method`, `bank_name`, `deposit_date`, `notes`, `created_at`) VALUES
(1, 4, 200000.00, 'transfer', '', '2025-12-23', 'I paid to moniepoint', '2025-12-23 13:02:21');

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

--
-- Table structure for table `company_expenses`
--

CREATE TABLE `company_expenses` (
  `id` int NOT NULL,
  `expense_title` varchar(150) NOT NULL,
  `category` varchar(100) DEFAULT NULL,
  `description` text,
  `amount` decimal(12,2) NOT NULL,
  `expense_date` date NOT NULL,
  `recorded_by` int DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `company_expenses`
--

INSERT INTO `company_expenses` (`id`, `expense_title`, `category`, `description`, `amount`, `expense_date`, `recorded_by`, `created_at`) VALUES
(1, 'Paid for Rent', 'Rent', 'Make rent payment worth 200,000 to the landlord', 200000.00, '2025-12-26', 1, '2025-12-26 14:35:28'),
(2, 'paid for staff', 'fuel', '', 60000.00, '2025-12-26', 1, '2025-12-26 16:27:23'),
(3, 'paid for staff', 'fuel', '', 60000.00, '2025-12-26', 1, '2025-12-26 16:27:41');

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

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

CREATE TABLE `customers` (
  `id` int NOT NULL,
  `customer_id` int NOT NULL,
  `customer_name` varchar(100) NOT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `address` text,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `customers` (`id`, `customer_id`, `customer_name`, `phone`, `email`, `address`, `created_at`) VALUES
(1, 1, 'VOKS Technologies Limited', '07032677286', 'godwinuche48@gmail.con', 'Akure', '2025-12-23 13:26:31'),
(2, 2, 'Mede Bread', '09032677287', 'admin@voks.com', 'Akure', '2025-12-23 17:27:24'),
(3, 3, 'Flourish', '08032677287', 'flo@gmail.com', 'Ore', '2025-12-24 13:27:41'),
(5, 0, 'Mama Peter Ventures', '07032677286', 'Paulo@gmail.com', 'Akure', '2025-12-27 01:51:12'),
(6, 0, 'Mama Chidi', '08108431680', 'Enocholaniyi99@gmail.com', '2, Ijigba2 street ilekun', '2026-01-01 10:23:06'),
(7, 0, 'Lopi', '08076541324', 'info@mireillefavour.com', 'Headquarters', '2026-01-05 07:17:55');

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

--
-- Table structure for table `customer_ledger`
--

CREATE TABLE `customer_ledger` (
  `id` int NOT NULL,
  `customer_id` int NOT NULL,
  `items` text NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','transfer','credit') NOT NULL,
  `transaction_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

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

CREATE TABLE `products` (
  `id` int NOT NULL,
  `product_name` varchar(150) DEFAULT NULL,
  `category` text NOT NULL,
  `cost_price` decimal(10,2) NOT NULL,
  `selling_price` decimal(10,2) NOT NULL,
  `quantity` int DEFAULT NULL,
  `alert_quantity` int NOT NULL DEFAULT '5',
  `status` enum('active','inactive') DEFAULT 'active',
  `sku` varchar(100) NOT NULL,
  `created_at` timestamp NOT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `discount_active` tinyint(1) NOT NULL DEFAULT '0',
  `discount_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `original_price` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

INSERT INTO `products` (`id`, `product_name`, `category`, `cost_price`, `selling_price`, `quantity`, `alert_quantity`, `status`, `sku`, `created_at`, `updated_at`, `discount_active`, `discount_amount`, `original_price`) VALUES
(1, 'PANLA', 'General', 35000.00, 38000.00, 49, 5, 'active', 'RICE50', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL),
(2, 'TITUS', 'FISH', 28000.00, 31000.00, 38, 5, 'active', 'BEANS25', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL),
(3, 'Cooking Oil (25L)', 'General', 32000.00, 34000.00, 17, 5, 'active', 'OIL25', '0000-00-00 00:00:00', NULL, 1, 2000.00, 36000.00),
(4, 'Sugar Bag', 'General', 30000.00, 34000.00, 10, 5, 'active', 'SUGAR50', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL),
(5, 'Rice Bag', 'General', 20000.00, 24000.00, 44, 5, '', '', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL),
(6, 'HAKE', 'FISH', 8000.00, 10000.00, 57, 5, 'active', '', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL),
(8, 'Fishes', 'Fish', 1000.00, 1800.00, 21, 5, 'active', '', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL),
(9, 'KOTE BX', 'Wears', 20000.00, 25000.00, 3, 2, 'active', '', '0000-00-00 00:00:00', NULL, 0, 0.00, 25000.00),
(10, 'SHAWA', 'FISH', 10000.00, 10500.00, 92, 5, 'active', '', '0000-00-00 00:00:00', NULL, 0, 0.00, NULL);

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

--
-- Table structure for table `sales`
--

CREATE TABLE `sales` (
  `id` int NOT NULL,
  `receipt_no` varchar(50) DEFAULT NULL,
  `staff_id` int DEFAULT NULL,
  `customer_id` int DEFAULT NULL,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `customer_name` varchar(100) DEFAULT NULL,
  `total_amount` decimal(10,2) DEFAULT NULL,
  `total_profit` decimal(10,2) DEFAULT NULL,
  `payment_status` enum('completed','outstanding','part_payment') NOT NULL,
  `payment_method` enum('cash','transfer') DEFAULT NULL,
  `sale_date` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `cash_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `moniepoint_amount` decimal(10,2) NOT NULL DEFAULT '0.00',
  `payment_type` enum('cash','moniepoint','cash_moniepoint') NOT NULL,
  `is_cancelled` tinyint(1) NOT NULL DEFAULT '0',
  `cancel_reason` text,
  `cancelled_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `sales`
--

INSERT INTO `sales` (`id`, `receipt_no`, `staff_id`, `customer_id`, `discount_amount`, `customer_name`, `total_amount`, `total_profit`, `payment_status`, `payment_method`, `sale_date`, `created_at`, `cash_amount`, `moniepoint_amount`, `payment_type`, `is_cancelled`, `cancel_reason`, `cancelled_at`) VALUES
(1, 'RCT1001', 1, NULL, 0.00, 'John Doe', 48000.00, 8000.00, 'completed', 'cash', '2025-12-23', '2025-12-23 09:15:15', 48000.00, 0.00, 'cash', 0, NULL, NULL),
(4, 'RCPT-1766515762', 4, 2, 0.00, 'Mede Bread', 76000.00, NULL, 'completed', 'cash', '2025-12-23', '2025-12-23 18:49:22', 76000.00, 0.00, 'cash', 0, NULL, NULL),
(6, 'RCPT-FDB5E380', 4, 2, 0.00, 'VOKS Technologies', 36000.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 06:35:35', 36000.00, 0.00, 'cash', 0, NULL, NULL),
(9, 'RCPT-15A6E94B', 1, 2, 0.00, NULL, 3600.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 09:10:47', 3600.00, 0.00, 'cash', 0, NULL, NULL),
(11, 'RCT1766570647', 5, NULL, 0.00, 'stop', 38000.00, 3000.00, 'completed', 'cash', '2025-12-24', '2025-12-24 10:04:07', 38000.00, 0.00, 'cash', 0, NULL, NULL),
(12, 'RCPT-E4CD80C6', 5, 2, 0.00, NULL, 228000.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 10:06:18', 228000.00, 0.00, 'cash', 0, NULL, NULL),
(13, 'RCT1766570954', 5, NULL, 0.00, 'reti', 84000.00, 10000.00, 'completed', 'cash', '2025-12-24', '2025-12-24 10:09:14', 84000.00, 0.00, 'cash', 0, NULL, NULL),
(14, 'RCT1766571151', 5, NULL, 0.00, 'gvgvhv', 322000.00, 32000.00, 'outstanding', 'cash', '2025-12-24', '2025-12-24 10:12:31', 322000.00, 0.00, 'cash', 0, NULL, NULL),
(15, 'RCPT-0F3A3906', 1, 2, 0.00, NULL, 25000.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 12:13:06', 25000.00, 0.00, 'cash', 0, NULL, NULL),
(16, 'RCPT-1407C0AC', 1, 2, 0.00, NULL, 10000.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 12:13:36', 10000.00, 0.00, 'cash', 0, NULL, NULL),
(20, 'RCT1766579184', 5, NULL, 0.00, 'erryrdry', 74000.00, 7000.00, 'completed', 'cash', '2025-12-24', '2025-12-24 12:26:24', 74000.00, 0.00, 'cash', 0, NULL, NULL),
(22, 'RCPT-94E7693A', 1, 2, 0.00, NULL, 1800.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 12:54:50', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(23, 'RCPT-8DF5F81C', 1, 1, 0.00, NULL, 38000.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 12:56:54', 38000.00, 0.00, 'cash', 0, NULL, NULL),
(24, 'RCPT-1631EDC8', 1, 1, 0.00, NULL, 10500.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 12:58:20', 10500.00, 0.00, 'cash', 0, NULL, NULL),
(26, 'RCPT-5984A164', 4, 2, 0.00, NULL, 1800.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 13:11:01', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(28, 'RCPT-3F64BD81', 4, 3, 0.00, NULL, 36000.00, NULL, 'completed', 'cash', '2025-12-24', '2025-12-24 14:42:31', 36000.00, 0.00, 'cash', 0, NULL, NULL),
(34, 'RCPT-0A23E67F', 1, 3, 0.00, NULL, 24000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 05:59:38', 24000.00, 0.00, 'cash', 0, NULL, NULL),
(35, 'RCPT-68FE2EFB', 1, 1, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 05:59:56', 0.00, 38000.00, 'moniepoint', 0, NULL, NULL),
(38, 'RCPT-78909FE9', 1, 3, 0.00, NULL, 10000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 08:14:11', 0.00, 10000.00, 'moniepoint', 0, NULL, NULL),
(39, 'RCPT-74D16871', 1, 2, 0.00, NULL, 10500.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 08:48:04', 10500.00, 0.00, 'cash', 0, NULL, NULL),
(40, 'RCPT-64A35B47', 1, 1, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 08:49:06', 0.00, 38000.00, 'moniepoint', 0, NULL, NULL),
(41, 'RCPT-0E8284B1', 1, 3, 0.00, NULL, 10000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 08:49:46', 2000.00, 8000.00, 'cash_moniepoint', 0, NULL, NULL),
(42, 'RCPT-F5A048BC', 4, 2, 0.00, NULL, 108000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 12:48:21', 8000.00, 100000.00, 'cash_moniepoint', 0, NULL, NULL),
(43, 'RCPT-F59C09F0', 4, 3, 0.00, NULL, 25000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 13:07:16', 25000.00, 0.00, 'cash', 0, NULL, NULL),
(44, 'RCPT-985BB68B', 1, 3, 0.00, NULL, 36000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 16:09:51', 20000.00, 16000.00, 'cash_moniepoint', 0, NULL, NULL),
(45, 'RCPT-C738C408', 1, 3, 0.00, NULL, 36000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 16:10:09', 20000.00, 16000.00, 'cash_moniepoint', 0, NULL, NULL),
(46, 'RCPT-B5D02DC8', 1, NULL, 0.00, NULL, 24000.00, NULL, 'completed', NULL, '2025-12-26', '2025-12-26 16:17:09', 10000.00, 14000.00, 'cash_moniepoint', 0, NULL, NULL),
(47, 'RCT1766767099', 5, NULL, 0.00, 'bnop', 31500.00, 1500.00, 'completed', 'cash', '2025-12-26', '2025-12-26 16:38:19', 0.00, 0.00, 'cash', 0, NULL, NULL),
(48, 'RCT1766767117', 5, NULL, 0.00, 'bnop', 31500.00, 1500.00, 'completed', 'cash', '2025-12-26', '2025-12-26 16:38:37', 0.00, 0.00, 'cash', 0, NULL, NULL),
(49, 'RCPT-CB626D6A', 4, NULL, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 01:32:05', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(50, 'RCPT-DBDA0E4D', 4, 5, 0.00, NULL, 0.00, 0.00, 'completed', NULL, '2026-01-01', '2025-12-27 01:51:26', 0.00, 0.00, 'moniepoint', 1, 'The customer got a refund', '2025-12-27 02:03:52'),
(51, 'RCPT-4B0D7A51', 4, 5, 0.00, NULL, 49000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 01:52:40', 9000.00, 40000.00, 'cash_moniepoint', 0, NULL, NULL),
(52, 'RCPT-3B769BCE', 4, 5, 0.00, NULL, 108000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 03:39:20', 0.00, 108000.00, 'moniepoint', 0, NULL, NULL),
(53, 'RCPT-A3D1133E', 5, 3, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 09:23:10', 14000.00, 24000.00, 'cash_moniepoint', 0, NULL, NULL),
(54, 'RCPT-36FD326A', 1, 3, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 10:45:42', 34000.00, 0.00, 'cash', 0, NULL, NULL),
(55, 'RCPT-1D07E4F2', 4, 5, 0.00, NULL, 10500.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 11:00:09', 5000.00, 5500.00, 'cash_moniepoint', 0, NULL, NULL),
(56, 'RCPT-BB171633', 1, 3, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 11:32:44', 34000.00, 0.00, 'cash', 0, NULL, NULL),
(57, 'JIREH-ED71CD32', 1, 5, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 11:39:41', 0.00, 34000.00, 'moniepoint', 0, NULL, NULL),
(58, 'JIREH-C0387E92', 1, 2, 0.00, NULL, 31000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 11:58:35', 31000.00, 0.00, 'cash', 0, NULL, NULL),
(59, 'JIREH-08247B9E', 4, 2, 0.00, NULL, 7200.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 12:31:38', 2200.00, 5000.00, 'cash_moniepoint', 0, NULL, NULL),
(60, 'JIREH-447620A1', 1, 1, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:02:25', 38000.00, 0.00, 'cash', 0, NULL, NULL),
(61, 'JIREH-07B663DA', 4, 5, 0.00, NULL, 41500.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:11:08', 41500.00, 0.00, 'cash', 0, NULL, NULL),
(62, 'JIREH-CC6D4E32', 5, 3, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:31:32', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(63, 'JIREH-CED179DF', 1, 5, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:43:05', 38000.00, 0.00, 'cash', 0, NULL, NULL),
(64, 'JIREH-0231102D', 1, 5, 0.00, NULL, 10000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:52:54', 10000.00, 0.00, 'cash', 0, NULL, NULL),
(65, 'JIREH-E8750C1C', 1, 5, 0.00, NULL, 31000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:55:32', 20000.00, 11000.00, 'cash_moniepoint', 0, NULL, NULL),
(66, 'JIREH-3EB53780', 1, 3, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 14:57:16', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(67, 'JIREH-C3AD0334', 1, 3, 0.00, NULL, 10500.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 15:00:51', 5000.00, 5500.00, 'cash_moniepoint', 0, NULL, NULL),
(68, 'JIREH-5F06EDE6', 5, 5, 0.00, NULL, 31000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 15:05:43', 20000.00, 11000.00, 'cash_moniepoint', 0, NULL, NULL),
(69, 'JIREH-8D0A5778', 5, 3, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2026-01-01', '2025-12-27 15:13:10', 0.00, 1800.00, 'moniepoint', 0, NULL, NULL),
(70, 'JIREH-148DC395', 5, 5, 0.00, NULL, 10000.00, NULL, 'completed', NULL, '2025-12-27', '2025-12-27 15:15:42', 10000.00, 0.00, 'cash', 0, NULL, NULL),
(71, 'JIREH-CC92AF68', 4, 3, 0.00, NULL, 31000.00, NULL, 'completed', NULL, '2025-12-31', '2025-12-31 16:03:33', 15000.00, 16000.00, 'cash_moniepoint', 0, NULL, NULL),
(72, 'JIREH-5596AC9E', 4, 2, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2025-12-31', '2025-12-31 16:04:32', 0.00, 1800.00, 'moniepoint', 0, NULL, NULL),
(73, 'JIREH-CF94E66A', 4, 3, 0.00, NULL, 24000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 08:59:30', 4000.00, 20000.00, 'cash_moniepoint', 0, NULL, NULL),
(74, 'JIREH-0F46C77C', 4, 3, 0.00, NULL, 25000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 10:19:42', 5000.00, 20000.00, 'cash_moniepoint', 0, NULL, NULL),
(75, 'JIREH-86F2821B', 4, 6, 0.00, NULL, 114000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 10:23:23', 114000.00, 0.00, 'cash', 0, NULL, NULL),
(76, 'JIREH-B3D509FB', 1, 6, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 10:29:50', 0.00, 34000.00, 'moniepoint', 0, NULL, NULL),
(77, 'JIREH-A74E0DA5', 4, 6, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2026-01-02', '2026-01-01 10:54:05', 0.00, 34000.00, 'moniepoint', 0, NULL, NULL),
(78, 'JIREH-C60232EE', 5, 6, 0.00, NULL, 10000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 12:58:10', 5000.00, 5000.00, 'cash_moniepoint', 0, NULL, NULL),
(79, 'JIREH-E7FE6587', 5, 2, 0.00, NULL, 10000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 12:58:55', 5000.00, 5000.00, 'cash_moniepoint', 0, NULL, NULL),
(80, 'JIREH-17126049', 5, 6, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 13:09:25', 1000.00, 800.00, 'cash_moniepoint', 0, NULL, NULL),
(81, 'JIREH-FC9C70E4', 5, 5, 0.00, NULL, 31000.00, NULL, 'completed', NULL, '2026-01-01', '2026-01-01 13:11:50', 30000.00, 1000.00, 'cash_moniepoint', 0, NULL, NULL),
(82, 'JIREH-7BFBCD0E', 5, 3, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2026-01-02', '2026-01-02 10:36:09', 20000.00, 14000.00, 'cash_moniepoint', 0, NULL, NULL),
(83, 'JIREH-5B906296', 5, 6, 0.00, NULL, 31000.00, NULL, 'completed', NULL, '2026-01-02', '2026-01-02 10:43:12', 20000.00, 11000.00, 'cash_moniepoint', 0, NULL, NULL),
(84, 'JIREH-AAE6C7F1', 1, 3, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2026-01-02', '2026-01-02 13:23:00', 38000.00, 0.00, 'cash', 0, NULL, NULL),
(85, 'JIREH-A4BDA6C0', 1, 6, 0.00, NULL, 38000.00, NULL, 'completed', NULL, '2026-01-02', '2026-01-02 13:25:03', 38000.00, 0.00, 'cash', 0, NULL, NULL),
(86, 'JIREH-C95B0F0D', 4, 6, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2026-01-02', '2026-01-02 13:44:21', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(87, 'JIREH-DEC97088', 1, 3, 0.00, NULL, 34000.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 05:39:51', 34000.00, 0.00, 'cash', 0, NULL, NULL),
(88, 'JIREH-1DC80E1E', 1, 6, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 06:09:09', 2000.00, 36000.00, 'moniepoint', 0, NULL, NULL),
(89, 'JIREH-821DB392', 1, 3, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 06:59:06', 21000.00, 20000.00, 'cash', 0, NULL, NULL),
(90, 'JIREH-9CDB932A', 1, 3, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 07:01:35', 0.00, 38000.00, 'moniepoint', 0, NULL, NULL),
(91, 'JIREH-2E0F1D6E', 1, 2, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 07:56:03', 10000.00, 28000.00, 'cash_moniepoint', 0, NULL, NULL),
(92, 'JIREH-A06E1372', 1, 6, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 12:57:23', 5000.00, 5000.00, 'cash_moniepoint', 0, NULL, NULL),
(93, 'JIREH-16FB2BF7', 1, 1, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-04 13:13:06', 25000.00, 0.00, 'cash', 0, NULL, NULL),
(94, 'JIREH-37D95687', 1, 6, 0.00, NULL, 1800.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 14:49:21', 1800.00, 0.00, 'cash', 0, NULL, NULL),
(95, 'JIREH-F9DE1355', 1, 5, 5000.00, NULL, 49500.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 14:56:45', 49500.00, 0.00, 'cash', 0, NULL, NULL),
(96, 'JIREH-6766EC5D', 1, 5, 2000.00, NULL, 55000.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 14:58:02', 55000.00, 0.00, 'cash', 0, NULL, NULL),
(97, 'JIREH-ED752A17', 1, 2, 3000.00, NULL, 38000.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 15:04:22', 0.00, 38000.00, 'moniepoint', 0, NULL, NULL),
(98, 'JIREH-331832EA', 1, 3, 2000.00, NULL, 21000.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 15:05:37', 21000.00, 0.00, 'cash', 0, NULL, NULL),
(99, 'JIREH-072CDD16', 1, 6, 2000.00, NULL, 21000.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 15:17:16', 21000.00, 0.00, 'cash', 0, NULL, NULL),
(100, 'JIREH-B1B259E4', 1, 2, 2000.00, NULL, 21000.00, NULL, 'completed', NULL, '2026-01-04', '2026-01-04 15:21:23', 21000.00, 0.00, 'cash', 0, NULL, NULL),
(101, 'JIREH-FE49CDC0', 1, 6, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-04 16:09:56', 44000.00, 0.00, 'cash', 0, NULL, NULL),
(102, 'JIREH-224AE186', 1, 3, 8000.00, NULL, 25000.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 05:49:16', 25000.00, 0.00, 'cash', 0, NULL, NULL),
(103, 'JIREH-9E92BC43', 1, 6, 800.00, NULL, 34200.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 05:55:36', 34200.00, 0.00, 'cash', 0, NULL, NULL),
(104, 'JIREH-DA532CFA', 1, 6, 500.00, NULL, 24000.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 06:08:41', 24000.00, 0.00, 'cash', 0, NULL, NULL),
(105, 'JIREH-A8B36D19', 1, 2, 500.00, NULL, 35000.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 06:19:59', 35000.00, 0.00, 'cash', 0, NULL, NULL),
(106, 'JIREH-C18D1794', 1, 1, 5000.00, NULL, 4000.00, NULL, 'part_payment', NULL, '2026-01-05', '2026-01-05 06:35:20', 25000.00, 25000.00, 'cash_moniepoint', 0, NULL, NULL),
(107, 'JIREH-5FB5FB18', 1, 1, 500.00, NULL, 4500.00, NULL, 'part_payment', NULL, '2026-01-05', '2026-01-05 06:43:27', 0.00, 20000.00, 'moniepoint', 0, NULL, NULL),
(108, 'JIREH-7CD6D5AC', 1, 2, 0.00, NULL, 0.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 06:47:53', 0.00, 10000.00, 'moniepoint', 0, NULL, NULL),
(109, 'JIREH-BC0F4DAB', 1, 1, 500.00, NULL, 4500.00, NULL, 'part_payment', NULL, '2026-01-05', '2026-01-05 06:56:47', 20000.00, 0.00, 'cash', 0, NULL, NULL),
(110, 'JIREH-EC2C2BE5', 1, 5, 500.00, NULL, 24500.00, NULL, 'outstanding', NULL, '2026-01-05', '2026-01-05 06:57:21', 0.00, 0.00, '', 0, NULL, NULL),
(111, 'JIREH-B0DB1942', 4, 3, 200.00, NULL, 9800.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 06:59:34', 9800.00, 0.00, 'cash', 0, NULL, NULL),
(112, 'JIREH-E5C9A843', 4, 6, 1000.00, NULL, 30000.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 07:00:36', 20000.00, 10000.00, 'cash_moniepoint', 0, NULL, NULL),
(113, 'JIREH-B543C9A7', 1, 7, 200.00, NULL, 9800.00, NULL, 'completed', NULL, '2026-01-05', '2026-01-05 07:18:28', 9800.00, 0.00, 'cash', 0, NULL, NULL);

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

--
-- Table structure for table `sale_items`
--

CREATE TABLE `sale_items` (
  `id` int NOT NULL,
  `sale_id` int NOT NULL,
  `product_id` int NOT NULL,
  `quantity` int NOT NULL,
  `price` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `sale_items`
--

INSERT INTO `sale_items` (`id`, `sale_id`, `product_id`, `quantity`, `price`) VALUES
(2, 4, 1, 2, 38000.00),
(4, 6, 3, 1, 36000.00),
(7, 9, 8, 2, 1800.00),
(9, 12, 1, 6, 38000.00),
(10, 15, 9, 1, 25000.00),
(11, 16, 6, 1, 10000.00),
(16, 22, 8, 1, 1800.00),
(17, 23, 1, 1, 38000.00),
(18, 24, 10, 1, 10500.00),
(20, 26, 8, 1, 1800.00),
(22, 28, 3, 1, 36000.00),
(30, 34, 5, 1, 24000.00),
(31, 35, 1, 1, 38000.00),
(34, 38, 6, 1, 10000.00),
(35, 39, 10, 1, 10500.00),
(36, 40, 1, 1, 38000.00),
(37, 41, 6, 1, 10000.00),
(38, 42, 3, 3, 36000.00),
(39, 43, 9, 1, 25000.00),
(40, 44, 3, 1, 36000.00),
(41, 45, 3, 1, 36000.00),
(42, 46, 5, 1, 24000.00),
(43, 49, 8, 1, 1800.00),
(44, 50, 3, 1, 36000.00),
(45, 51, 9, 1, 25000.00),
(46, 51, 5, 1, 24000.00),
(47, 52, 3, 3, 36000.00),
(48, 53, 1, 1, 38000.00),
(49, 54, 4, 1, 34000.00),
(50, 55, 10, 1, 10500.00),
(51, 56, 4, 1, 34000.00),
(52, 57, 4, 1, 34000.00),
(53, 58, 2, 1, 31000.00),
(54, 59, 8, 4, 1800.00),
(55, 60, 1, 1, 38000.00),
(56, 61, 10, 1, 10500.00),
(57, 61, 2, 1, 31000.00),
(58, 62, 8, 1, 1800.00),
(59, 63, 1, 1, 38000.00),
(60, 64, 6, 1, 10000.00),
(61, 65, 2, 1, 31000.00),
(62, 66, 8, 1, 1800.00),
(63, 67, 10, 1, 10500.00),
(64, 68, 2, 1, 31000.00),
(65, 69, 8, 1, 1800.00),
(66, 70, 6, 1, 10000.00),
(67, 71, 2, 1, 31000.00),
(68, 72, 8, 1, 1800.00),
(69, 73, 5, 1, 24000.00),
(70, 74, 9, 1, 25000.00),
(71, 75, 1, 3, 38000.00),
(72, 76, 4, 1, 34000.00),
(73, 77, 4, 1, 34000.00),
(74, 78, 6, 1, 10000.00),
(75, 79, 6, 1, 10000.00),
(76, 80, 8, 1, 1800.00),
(77, 81, 2, 1, 31000.00),
(78, 82, 4, 1, 34000.00),
(79, 83, 2, 1, 31000.00),
(80, 84, 1, 1, 38000.00),
(81, 85, 1, 1, 38000.00),
(82, 86, 8, 1, 1800.00),
(83, 87, 3, 1, 34000.00),
(84, 88, 3, 1, 34000.00),
(85, 89, 6, 1, 10000.00),
(86, 89, 2, 1, 31000.00),
(87, 90, 1, 1, 38000.00),
(88, 91, 1, 1, 38000.00),
(89, 92, 6, 1, 10000.00),
(90, 93, 9, 1, 25000.00),
(91, 94, 8, 1, 1800.00),
(92, 95, 9, 1, 25000.00),
(93, 95, 10, 1, 10500.00),
(94, 95, 5, 1, 24000.00),
(95, 96, 9, 1, 25000.00),
(96, 96, 4, 1, 34000.00),
(97, 97, 6, 1, 10000.00),
(98, 97, 4, 1, 34000.00),
(99, 98, 9, 1, 25000.00),
(100, 99, 9, 1, 25000.00),
(101, 100, 9, 1, 25000.00),
(102, 101, 3, 1, 34000.00),
(103, 101, 6, 1, 10000.00),
(104, 102, 6, 1, 10000.00),
(105, 102, 2, 1, 31000.00),
(106, 103, 8, 1, 1800.00),
(107, 103, 4, 1, 34000.00),
(108, 104, 9, 1, 25000.00),
(109, 105, 9, 1, 25000.00),
(110, 105, 10, 1, 10500.00),
(111, 106, 9, 1, 25000.00),
(112, 106, 4, 1, 34000.00),
(113, 107, 9, 1, 25000.00),
(114, 108, 6, 1, 10000.00),
(115, 109, 9, 1, 25000.00),
(116, 110, 9, 1, 25000.00),
(117, 111, 6, 1, 10000.00),
(118, 112, 2, 1, 31000.00),
(119, 113, 6, 1, 10000.00);

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

--
-- Table structure for table `staff_salaries`
--

CREATE TABLE `staff_salaries` (
  `id` int NOT NULL,
  `staff_id` int NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','transfer') NOT NULL,
  `salary_month` char(7) NOT NULL COMMENT 'YYYY-MM',
  `notes` text,
  `payment_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `staff_salaries`
--

INSERT INTO `staff_salaries` (`id`, `staff_id`, `amount`, `payment_method`, `salary_month`, `notes`, `payment_date`, `created_at`) VALUES
(1, 4, 50000.00, 'transfer', '2025-12', 'Fully paid', '0000-00-00', '2025-12-23 11:56:47');

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

--
-- Table structure for table `stock_movements`
--

CREATE TABLE `stock_movements` (
  `id` int NOT NULL,
  `product_id` int NOT NULL,
  `movement_date` date NOT NULL,
  `opening_stock` int NOT NULL DEFAULT '0',
  `stock_in` int NOT NULL DEFAULT '0',
  `stock_out` int NOT NULL DEFAULT '0',
  `closing_stock` int NOT NULL DEFAULT '0',
  `note` varchar(255) DEFAULT NULL,
  `recorded_by` int NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `stock_movements`
--

INSERT INTO `stock_movements` (`id`, `product_id`, `movement_date`, `opening_stock`, `stock_in`, `stock_out`, `closing_stock`, `note`, `recorded_by`, `created_at`) VALUES
(1, 8, '2025-12-22', 20, 20, 2, 38, '', 1, '2025-12-24 06:50:47'),
(2, 8, '2025-12-24', 38, 0, 4, 34, NULL, 1, '2025-12-24 09:10:47'),
(3, 2, '2025-12-24', 50, 0, 2, 48, NULL, 1, '2025-12-24 09:13:07'),
(5, 9, '2025-12-24', 10, 0, 3, 7, NULL, 1, '2025-12-24 12:13:06'),
(6, 6, '2025-12-24', 76, 0, 4, 72, NULL, 1, '2025-12-24 12:13:36'),
(11, 10, '2025-12-24', 100, 0, 1, 99, NULL, 1, '2025-12-24 12:58:20'),
(13, 3, '2025-12-24', 1, 0, 1, 0, NULL, 4, '2025-12-24 14:42:31'),
(16, 10, '2025-12-26', 99, 0, 2, 97, NULL, 1, '2025-12-26 05:56:42'),
(17, 5, '2025-12-26', 50, 0, 3, 47, NULL, 1, '2025-12-26 05:59:38'),
(18, 1, '2025-12-26', 61, 0, 2, 59, NULL, 1, '2025-12-26 05:59:56'),
(19, 6, '2025-12-26', 72, 0, 3, 69, NULL, 1, '2025-12-26 07:44:31'),
(20, 3, '2025-12-26', 10, 0, 5, 5, NULL, 4, '2025-12-26 12:48:21'),
(21, 9, '2025-12-26', 7, 0, 1, 6, NULL, 4, '2025-12-26 13:07:16'),
(22, 8, '2025-12-27', 34, 0, 8, 26, NULL, 4, '2025-12-27 01:32:05'),
(23, 3, '2025-12-27', 5, 0, 4, 1, NULL, 4, '2025-12-27 01:51:26'),
(24, 9, '2025-12-27', 6, 0, 1, 5, NULL, 4, '2025-12-27 01:52:40'),
(25, 5, '2025-12-27', 47, 0, 1, 46, NULL, 4, '2025-12-27 01:52:40'),
(27, 4, '2025-12-27', 20, 0, 3, 17, NULL, 1, '2025-12-27 10:45:42'),
(28, 10, '2025-12-27', 97, 0, 3, 94, NULL, 4, '2025-12-27 11:00:09'),
(29, 2, '2025-12-27', 48, 0, 4, 44, NULL, 1, '2025-12-27 11:58:35'),
(30, 6, '2025-12-27', 69, 0, 2, 67, NULL, 1, '2025-12-27 14:52:54'),
(31, 2, '2025-12-31', 44, 0, 1, 43, NULL, 4, '2025-12-31 16:03:33'),
(32, 8, '2025-12-31', 26, 0, 1, 25, NULL, 4, '2025-12-31 16:04:32'),
(33, 5, '2026-01-01', 46, 0, 1, 45, NULL, 4, '2026-01-01 08:59:30');

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

--
-- Table structure for table `suppliers`
--

CREATE TABLE `suppliers` (
  `id` int NOT NULL,
  `supplier_name` varchar(150) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL,
  `address` text,
  `email` varchar(100) NOT NULL,
  `created_at` timestamp NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `suppliers`
--

INSERT INTO `suppliers` (`id`, `supplier_name`, `phone`, `address`, `email`, `created_at`) VALUES
(4, 'Delight', '7032677286', 'Akure', 'godwinuche48@gmail.con', '0000-00-00 00:00:00'),
(5, 'MM;K', '09023444222', 'DNKMKM', 'EMLOO22@GMAIL.COM', '0000-00-00 00:00:00');

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

--
-- Table structure for table `supplier_ledger`
--

CREATE TABLE `supplier_ledger` (
  `id` int NOT NULL,
  `supplier_id` int NOT NULL,
  `product_id` int DEFAULT NULL,
  `item_name` varchar(100) NOT NULL,
  `quantity` int NOT NULL,
  `amount_paid` decimal(12,2) NOT NULL,
  `payment_method` varchar(30) DEFAULT NULL,
  `transaction_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `status` enum('active','cancelled') DEFAULT 'active',
  `cancel_reason` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `supplier_ledger`
--

INSERT INTO `supplier_ledger` (`id`, `supplier_id`, `product_id`, `item_name`, `quantity`, `amount_paid`, `payment_method`, `transaction_date`, `created_at`, `status`, `cancel_reason`) VALUES
(1, 4, NULL, 'Perfumes', 100, 100000.00, 'transfer', '2025-12-24', '2025-12-23 14:33:41', 'active', NULL),
(3, 4, NULL, 'Fishes', 78, 9000.00, 'cash', '2025-12-30', '2025-12-30 15:22:38', 'active', NULL),
(4, 4, NULL, 'Fishes', 78, 9000.00, 'cash', '2025-12-30', '2025-12-30 15:22:39', 'active', NULL),
(5, 4, NULL, 'Fishes', 78, 9000.00, 'cash', '2025-12-30', '2025-12-30 15:24:22', 'active', NULL),
(6, 5, NULL, 'Shaw', 780, 78889898.00, 'cash', '2026-01-10', '2026-01-03 14:39:18', 'active', NULL);

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

--
-- Table structure for table `transport_expenses`
--

CREATE TABLE `transport_expenses` (
  `id` int NOT NULL,
  `expense_type` enum('fuel','maintenance','repair','other') NOT NULL,
  `lorry_number` varchar(50) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','transfer') NOT NULL,
  `description` text,
  `expense_date` date NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `transport_expenses`
--

INSERT INTO `transport_expenses` (`id`, `expense_type`, `lorry_number`, `amount`, `payment_method`, `description`, `expense_date`, `created_at`) VALUES
(1, 'maintenance', '12345', 50000.00, 'transfer', 'Gear', '2025-12-24', '2025-12-23 12:24:34'),
(2, 'repair', '12345', 40000.00, 'transfer', 'Fix lorry', '2025-12-27', '2025-12-27 03:18:48');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `bank_deposits`
--
ALTER TABLE `bank_deposits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_bank_deposit_staff` (`staff_id`);

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

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

--
-- Indexes for table `customer_ledger`
--
ALTER TABLE `customer_ledger`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_id` (`customer_id`);

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

--
-- Indexes for table `sales`
--
ALTER TABLE `sales`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_sales_customer` (`customer_id`);

--
-- Indexes for table `sale_items`
--
ALTER TABLE `sale_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sale_id` (`sale_id`),
  ADD KEY `product_id` (`product_id`);

--
-- Indexes for table `staff_salaries`
--
ALTER TABLE `staff_salaries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_staff_salary` (`staff_id`);

--
-- Indexes for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_product_day` (`product_id`,`movement_date`),
  ADD KEY `recorded_by` (`recorded_by`);

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

--
-- Indexes for table `supplier_ledger`
--
ALTER TABLE `supplier_ledger`
  ADD PRIMARY KEY (`id`),
  ADD KEY `supplier_id` (`supplier_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `bank_deposits`
--
ALTER TABLE `bank_deposits`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

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

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `customer_ledger`
--
ALTER TABLE `customer_ledger`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `sales`
--
ALTER TABLE `sales`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=114;

--
-- AUTO_INCREMENT for table `sale_items`
--
ALTER TABLE `sale_items`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=120;

--
-- AUTO_INCREMENT for table `staff_salaries`
--
ALTER TABLE `staff_salaries`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `stock_movements`
--
ALTER TABLE `stock_movements`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;

--
-- AUTO_INCREMENT for table `suppliers`
--
ALTER TABLE `suppliers`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `supplier_ledger`
--
ALTER TABLE `supplier_ledger`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `transport_expenses`
--
ALTER TABLE `transport_expenses`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `bank_deposits`
--
ALTER TABLE `bank_deposits`
  ADD CONSTRAINT `fk_bank_deposit_staff` FOREIGN KEY (`staff_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `customer_ledger`
--
ALTER TABLE `customer_ledger`
  ADD CONSTRAINT `customer_ledger_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sales`
--
ALTER TABLE `sales`
  ADD CONSTRAINT `fk_sales_customer` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `sale_items`
--
ALTER TABLE `sale_items`
  ADD CONSTRAINT `sale_items_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sale_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `staff_salaries`
--
ALTER TABLE `staff_salaries`
  ADD CONSTRAINT `fk_staff_salary` FOREIGN KEY (`staff_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD CONSTRAINT `stock_movements_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_movements_ibfk_2` FOREIGN KEY (`recorded_by`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `supplier_ledger`
--
ALTER TABLE `supplier_ledger`
  ADD CONSTRAINT `supplier_ledger_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE;
COMMIT;

