-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jul 27, 2026 at 04:24 PM
-- Server version: 10.4.27-MariaDB
-- PHP Version: 8.1.12

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: `sellbazar`
--

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

--
-- Table structure for table `account_transactions`
--

CREATE TABLE `account_transactions` (
  `id` int(11) NOT NULL,
  `account_id` int(11) NOT NULL,
  `transaction_type` enum('deposit','withdrawal','transfer_in','transfer_out') NOT NULL,
  `reference_no` varchar(50) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `transaction_date` date NOT NULL,
  `description` 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;

--
-- Dumping data for table `account_transactions`
--

INSERT INTO `account_transactions` (`id`, `account_id`, `transaction_type`, `reference_no`, `amount`, `transaction_date`, `description`, `created_by`, `created_at`) VALUES
(1, 1, 'deposit', 'DEP-20260727-7673', '22222.00', '2026-07-27', 'Deposit', 1, '2026-07-27 14:19:25'),
(2, 1, 'withdrawal', 'WTH-20260727-6510', '22222.00', '2026-07-27', 'Withdrawal', 1, '2026-07-27 14:19:40');

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

--
-- Table structure for table `bank_accounts`
--

CREATE TABLE `bank_accounts` (
  `id` int(11) NOT NULL,
  `account_name` varchar(255) NOT NULL,
  `account_number` varchar(50) NOT NULL,
  `bank_name` varchar(255) NOT NULL,
  `branch_name` varchar(255) DEFAULT NULL,
  `account_type` enum('savings','current','loan','fixed_deposit') DEFAULT 'savings',
  `currency` varchar(10) DEFAULT 'BDT',
  `opening_balance` decimal(10,2) DEFAULT 0.00,
  `current_balance` decimal(10,2) DEFAULT 0.00,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `bank_accounts`
--

INSERT INTO `bank_accounts` (`id`, `account_name`, `account_number`, `bank_name`, `branch_name`, `account_type`, `currency`, `opening_balance`, `current_balance`, `status`, `created_at`) VALUES
(1, 'SellBazar Main Account', 'SB-001-123456', 'Dutch Bangla Bank', 'Motijheel Branch', 'current', 'BDT', '100000.00', '100000.00', 1, '2026-07-27 14:11:34'),
(2, 'SellBazar Savings', 'SB-001-789012', 'BRAC Bank', 'Gulshan Branch', 'savings', 'BDT', '50000.00', '50000.00', 1, '2026-07-27 14:11:34');

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

--
-- Table structure for table `banners`
--

CREATE TABLE `banners` (
  `id` int(11) NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `image` varchar(255) NOT NULL,
  `link` varchar(255) DEFAULT NULL,
  `order` int(11) NOT NULL DEFAULT 0,
  `status` tinyint(1) DEFAULT 1,
  `description` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `banners`
--

INSERT INTO `banners` (`id`, `title`, `image`, `link`, `order`, `status`, `description`, `created_at`) VALUES
(1, 'Three Piece', '1784950999_6a6430d740ad2.jpg', '/shop.php?category=three-piece', 20, 1, 'dd', '2026-07-25 03:40:43'),
(2, 'Nowshin three piece', '1784951071_6a64311fde157.avif', '/shop.php?category=nowshin-three-pc', 10, 1, 'dd', '2026-07-25 03:44:31'),
(3, '', '1784951148_6a64316c8ab69.jpg', '/shop.php?category=suit', 10, 1, 'sdsada', '2026-07-25 03:45:48');

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

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

CREATE TABLE `categories` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `categories` (`id`, `name`, `slug`, `image`, `description`, `status`, `created_at`) VALUES
(2, 'Jaket', 'jaket', '1784741719_6a60ff57d9efc.jpg', 'Clothing and accessories', 1, '2026-07-19 15:38:58'),
(3, 'Pant', 'pant', '1784741801_6a60ffa97fd1d.jpg', 'Formal pant free size', 1, '2026-07-19 15:38:58'),
(4, 'Fashion Sandals', 'fashion-sandals', '1784741920_6a610020132b7.jpg', 'Fashion Sandals Stock Photos, Images and Backgrounds for ...', 1, '2026-07-19 15:38:58'),
(5, 'Long Sleeve', 'long-sleeve', '1784643067_6a5f7dfb496f0.webp', 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 1, '2026-07-21 14:11:07'),
(6, 'Shirt', 'shirt-1784741423', '1784739344_6a60f610b7152.webp', 'Product Type: Katua\r\nGender: Men&amp;#039;s\r\nMaterial: 100% SATIN COTTON FABRIC\r\nHigh Quality Material\r\nSwing: Export Quality\r\nPocket: No\r\nComfortable and Soft\r\nColor and quality 100% guarantee\r\nFashionable and comfortable for every season\r\nSize: M, L, XL, XXL\r\n\r\nM  = Length: 28”- Chest: 40”\r\nL   = Length: 29” -Chest: 42”\r\nXL  = Length: 30”-Chest: 44”\r\nXXL = Lenght 31”- Chest- 46”', 1, '2026-07-22 16:55:44'),
(7, 'Katua', 'katua', '1784739414_6a60f65629a77.webp', 'Product Type: Katua\r\nGender: Men&#039;s\r\nMaterial: 100% SATIN COTTON FABRIC\r\nHigh Quality Material\r\nSwing: Export Quality\r\nPocket: No\r\nComfortable and Soft\r\nColor and quality 100% guarantee\r\nFashionable and comfortable for every season\r\nSize: M, L, XL, XXL\r\n\r\nM  = Length: 28”- Chest: 40”\r\nL   = Length: 29” -Chest: 42”\r\nXL  = Length: 30”-Chest: 44”\r\nXXL = Lenght 31”- Chest- 46”', 1, '2026-07-22 16:56:54'),
(8, 'Shoe', 'shoe', '1784742594_6a6102c2a638f.png', 'Fine Cotton Fabrics\r\nOne Pocket\r\nExport Quality Swing \r\nColor and quality 100% guarantee\r\nComfortable for every season\r\nSlim Fit\r\nize: M, L, XL, XXL\r\nSize Measurement:\r\nM : Length: 28”- Chest: 40”\r\nL : Length: 29” - Chest: 42”\r\nXL: Length: 30”- Chest: 44”\r\nXXL: Length 31”- Chest: 46”', 1, '2026-07-22 16:58:06'),
(13, 'Shoes', 'shoes', '1784805778_6a61f99230d72.jpg', '', 1, '2026-07-23 11:22:58'),
(14, 'Three Piece', 'three-piece', '1784891071_6a6346bf2d100.jpg', 'new', 1, '2026-07-24 11:00:34'),
(15, 'Nowshin three pc', 'nowshin-three-pc', '1784891241_6a6347693017b.jpg', 'Latest Luxury Haute Collection \r\n\r\nFARHA is a Beautiful velvet abaya with stunning sleeve embroidery, with a delicate silk inner and scarf\r\n\r\nAbaya, inner and scarf included', 1, '2026-07-24 11:07:21'),
(16, 'Suit', 'suit', '1784891508_6a634874e160e.png', 'Brown Three Piece Suit for Men Wedding Party Wear,', 1, '2026-07-24 11:11:48');

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

--
-- Table structure for table `coupons`
--

CREATE TABLE `coupons` (
  `id` int(11) NOT NULL,
  `code` varchar(50) NOT NULL,
  `discount_type` enum('percentage','fixed') DEFAULT 'percentage',
  `discount_amount` decimal(10,2) NOT NULL,
  `min_order` decimal(10,2) DEFAULT 0.00,
  `usage_limit` int(11) DEFAULT NULL,
  `used_count` int(11) DEFAULT 0,
  `expires_at` datetime DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `couriers`
--

CREATE TABLE `couriers` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `code` varchar(50) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `tracking_url` varchar(255) DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `couriers`
--

INSERT INTO `couriers` (`id`, `name`, `code`, `phone`, `email`, `website`, `tracking_url`, `status`, `created_at`) VALUES
(1, 'Sundarban Courier', 'SUNDARBAN', '017XXXXXXXX', 'info@sundarban.com', NULL, 'https://sundarbancourier.com/track', 1, '2026-07-26 10:24:20'),
(2, 'SA Paribahan', 'SA', '017XXXXXXXX', 'info@saparibahan.com', NULL, 'https://saparibahan.com/track', 1, '2026-07-26 10:24:20'),
(3, 'Pathao', 'PATHAO', '017XXXXXXXX', 'info@pathao.com', NULL, 'https://pathao.com/track', 1, '2026-07-26 10:24:20'),
(4, 'Paperfly', 'PAPERFLY', '017XXXXXXXX', 'info@paperfly.com', 'www.pathao.com', 'https://paperfly.com/track', 1, '2026-07-26 10:24:20'),
(5, 'RedX', 'REDX', '017XXXXXXXX', 'info@redx.com', NULL, 'https://redx.com/track', 1, '2026-07-26 10:24:20');

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

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

CREATE TABLE `customers` (
  `id` int(11) NOT NULL,
  `customer_code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `phone` varchar(20) NOT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `area` varchar(100) DEFAULT NULL,
  `total_orders` int(11) DEFAULT 0,
  `total_spent` decimal(10,2) DEFAULT 0.00,
  `last_order_date` date DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `customers` (`id`, `customer_code`, `name`, `email`, `phone`, `address`, `city`, `area`, `total_orders`, `total_spent`, `last_order_date`, `status`, `created_at`) VALUES
(1, 'CUS-20260726-6318', 'rasel', NULL, '01764197001', 'tg,ggg', NULL, NULL, 0, '0.00', NULL, 1, '2026-07-26 11:41:23'),
(2, 'CUS-20260726-9539', 'Admin', NULL, '01764197011', 'tg,ggg', NULL, NULL, 1, '550.00', NULL, 1, '2026-07-26 11:53:00');

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

--
-- Table structure for table `delivery_agents`
--

CREATE TABLE `delivery_agents` (
  `id` int(11) NOT NULL,
  `agent_code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `area` varchar(100) DEFAULT NULL,
  `vehicle_type` varchar(50) DEFAULT NULL,
  `vehicle_number` varchar(50) DEFAULT NULL,
  `total_deliveries` int(11) DEFAULT 0,
  `successful_deliveries` int(11) DEFAULT 0,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `delivery_agents`
--

INSERT INTO `delivery_agents` (`id`, `agent_code`, `name`, `phone`, `email`, `address`, `area`, `vehicle_type`, `vehicle_number`, `total_deliveries`, `successful_deliveries`, `status`, `created_at`) VALUES
(1, 'AG-001', 'Rahim Mia', '017XXXXXXX1', NULL, NULL, 'Dhaka', 'Bike', NULL, 0, 0, 1, '2026-07-26 11:35:02'),
(2, 'AG-002', 'Karim Uddin', '017XXXXXXX2', NULL, NULL, 'Dhaka', 'Bike', NULL, 0, 0, 1, '2026-07-26 11:35:02'),
(3, 'AG-003', 'Jabbar Ali', '017XXXXXXX3', NULL, NULL, 'Gazipur', 'Car', NULL, 0, 0, 1, '2026-07-26 11:35:02');

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

--
-- Table structure for table `delivery_reports`
--

CREATE TABLE `delivery_reports` (
  `id` int(11) NOT NULL,
  `report_no` varchar(50) NOT NULL,
  `delivery_date` date NOT NULL,
  `order_id` int(11) DEFAULT NULL,
  `invoice_no` varchar(50) DEFAULT NULL,
  `customer_name` varchar(255) NOT NULL,
  `customer_phone` varchar(20) NOT NULL,
  `customer_address` text NOT NULL,
  `area` varchar(100) DEFAULT NULL,
  `delivery_agent` varchar(100) DEFAULT NULL,
  `delivery_status` enum('pending','assigned','picked','in_transit','delivered','returned','cancelled') DEFAULT 'pending',
  `delivery_charge` decimal(10,2) DEFAULT 0.00,
  `cod_amount` decimal(10,2) DEFAULT 0.00,
  `collected_amount` decimal(10,2) DEFAULT 0.00,
  `delivery_time` time DEFAULT NULL,
  `signature` varchar(255) DEFAULT NULL,
  `note` 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;

--
-- Dumping data for table `delivery_reports`
--

INSERT INTO `delivery_reports` (`id`, `report_no`, `delivery_date`, `order_id`, `invoice_no`, `customer_name`, `customer_phone`, `customer_address`, `area`, `delivery_agent`, `delivery_status`, `delivery_charge`, `cod_amount`, `collected_amount`, `delivery_time`, `signature`, `note`, `created_by`, `created_at`) VALUES
(1, 'DLV-20260726-8138', '2026-07-26', 17, 'INV-20260726-6A65916B2ED62', 'rasel', '01764197001', 'ddfdf', NULL, NULL, 'delivered', '0.00', '2000.00', '0.00', NULL, NULL, NULL, 1, '2026-07-26 12:08:37'),
(2, 'DLV-20260726-9267', '2026-07-22', 13, 'INV-20260722-6A60F2F5CF04C', 'rasel', '01764197001', 'fgdsfgdhggh fgdg', NULL, NULL, 'delivered', '0.00', '1050.00', '0.00', NULL, NULL, NULL, 1, '2026-07-26 12:08:37');

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

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `code` varchar(50) NOT NULL,
  `description` text DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `code`, `description`, `status`, `created_at`) VALUES
(1, 'Management', 'MGT', 'Management Team', 1, '2026-07-26 12:45:51'),
(2, 'Sales', 'SALES', 'Sales Department', 1, '2026-07-26 12:45:51'),
(3, 'Marketing', 'MKT', 'Marketing Department', 1, '2026-07-26 12:45:51'),
(4, 'Operations', 'OPS', 'Operations Department', 1, '2026-07-26 12:45:51'),
(5, 'Finance', 'FIN', 'Finance Department', 1, '2026-07-26 12:45:51'),
(6, 'Customer Service', 'CS', 'Customer Service Department', 1, '2026-07-26 12:45:51');

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

--
-- Table structure for table `deposits`
--

CREATE TABLE `deposits` (
  `id` int(11) NOT NULL,
  `deposit_no` varchar(50) NOT NULL,
  `account_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `deposit_date` date NOT NULL,
  `payment_method` enum('cash','bank','bkash','nagad','rocket','card','other') DEFAULT 'cash',
  `reference_no` varchar(100) DEFAULT NULL,
  `source` varchar(100) DEFAULT NULL,
  `note` 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;

--
-- Dumping data for table `deposits`
--

INSERT INTO `deposits` (`id`, `deposit_no`, `account_id`, `amount`, `deposit_date`, `payment_method`, `reference_no`, `source`, `note`, `created_by`, `created_at`) VALUES
(1, 'DEP-20260727-7673', 1, '22222.00', '2026-07-27', 'cash', '', '', '', 1, '2026-07-27 14:19:25');

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

--
-- Table structure for table `designations`
--

CREATE TABLE `designations` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `department_id` int(11) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `designations`
--

INSERT INTO `designations` (`id`, `name`, `department_id`, `description`, `status`, `created_at`) VALUES
(1, 'CEO', 1, NULL, 1, '2026-07-26 12:45:51'),
(2, 'Manager', 1, NULL, 1, '2026-07-26 12:45:51'),
(3, 'Sales Executive', 2, NULL, 1, '2026-07-26 12:45:51'),
(4, 'Marketing Executive', 3, NULL, 1, '2026-07-26 12:45:51'),
(5, 'Accountant', 5, NULL, 1, '2026-07-26 12:45:51'),
(6, 'Customer Support', 6, NULL, 1, '2026-07-26 12:45:51');

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

--
-- Table structure for table `employees`
--

CREATE TABLE `employees` (
  `id` int(11) NOT NULL,
  `employee_code` varchar(50) NOT NULL,
  `first_name` varchar(100) NOT NULL,
  `last_name` varchar(100) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `phone` varchar(20) NOT NULL,
  `alternative_phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `gender` enum('male','female','other') DEFAULT 'male',
  `joining_date` date NOT NULL,
  `department` varchar(100) DEFAULT NULL,
  `designation` varchar(100) DEFAULT NULL,
  `salary_type` enum('monthly','hourly','project') DEFAULT 'monthly',
  `base_salary` decimal(10,2) DEFAULT 0.00,
  `allowance` decimal(10,2) DEFAULT 0.00,
  `bonus` decimal(10,2) DEFAULT 0.00,
  `bank_name` varchar(100) DEFAULT NULL,
  `bank_account_no` varchar(50) DEFAULT NULL,
  `emergency_contact_name` varchar(100) DEFAULT NULL,
  `emergency_contact_phone` varchar(20) DEFAULT NULL,
  `emergency_contact_relation` varchar(50) DEFAULT NULL,
  `employee_type` enum('full_time','part_time','contract','intern') DEFAULT 'full_time',
  `status` tinyint(1) DEFAULT 1,
  `profile_image` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employees`
--

INSERT INTO `employees` (`id`, `employee_code`, `first_name`, `last_name`, `email`, `phone`, `alternative_phone`, `address`, `city`, `date_of_birth`, `gender`, `joining_date`, `department`, `designation`, `salary_type`, `base_salary`, `allowance`, `bonus`, `bank_name`, `bank_account_no`, `emergency_contact_name`, `emergency_contact_phone`, `emergency_contact_relation`, `employee_type`, `status`, `profile_image`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 'EMP-20260727-1302', 'Shekh', 'Rasel', 'work.smrasel@gmail.com', '01764197001', '', '334/A', 'Kushtia', '2024-02-14', 'male', '2026-07-27', 'Sales', '', 'monthly', '10000.00', '200.00', '0.00', '', '', 'Shekh Md Rasel', '01764197001', '', 'full_time', 1, NULL, 1, '2026-07-27 05:17:36', NULL);

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

--
-- Table structure for table `employee_attendance`
--

CREATE TABLE `employee_attendance` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `check_in` time DEFAULT NULL,
  `check_out` time DEFAULT NULL,
  `status` enum('present','absent','late','half_day','holiday','leave','sick_leave','casual_leave','emergency_leave') DEFAULT 'present',
  `is_approved` tinyint(1) NOT NULL DEFAULT 1,
  `overtime_hours` decimal(5,2) DEFAULT 0.00,
  `note` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `employee_attendance`
--

INSERT INTO `employee_attendance` (`id`, `employee_id`, `date`, `check_in`, `check_out`, `status`, `is_approved`, `overtime_hours`, `note`, `created_at`) VALUES
(1, 1, '2026-07-27', '09:55:00', '18:02:00', 'present', 1, '0.00', '', '2026-07-27 05:19:46'),
(2, 1, '2026-07-26', '00:00:00', '00:00:00', 'absent', 1, '0.00', '', '2026-07-27 08:40:11'),
(3, 1, '2026-07-25', '00:00:00', '00:00:00', 'absent', 1, '0.00', '', '2026-07-27 08:42:08'),
(4, 1, '2026-06-01', '00:00:00', '00:00:00', 'present', 1, '0.00', '', '2026-07-27 08:42:42'),
(5, 1, '2026-06-02', '00:00:00', '00:00:00', 'present', 1, '0.00', '', '2026-07-27 08:49:05');

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

--
-- Table structure for table `employee_leaves`
--

CREATE TABLE `employee_leaves` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `leave_type` enum('annual','sick','casual','emergency','maternity','paternity','other') NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `total_days` int(11) DEFAULT 0,
  `reason` text DEFAULT NULL,
  `status` enum('pending','approved','rejected','cancelled') DEFAULT 'pending',
  `approved_by` int(11) DEFAULT NULL,
  `approved_at` datetime 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 `employee_salaries`
--

CREATE TABLE `employee_salaries` (
  `id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `month` date NOT NULL,
  `base_salary` decimal(10,2) DEFAULT 0.00,
  `allowance` decimal(10,2) DEFAULT 0.00,
  `bonus` decimal(10,2) DEFAULT 0.00,
  `deduction` decimal(10,2) DEFAULT 0.00,
  `net_salary` decimal(10,2) DEFAULT 0.00,
  `payment_date` date DEFAULT NULL,
  `payment_method` enum('cash','bank','mobile_banking') DEFAULT 'cash',
  `transaction_no` varchar(100) DEFAULT NULL,
  `status` enum('draft','paid','pending') DEFAULT 'draft',
  `note` 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;

--
-- Dumping data for table `employee_salaries`
--

INSERT INTO `employee_salaries` (`id`, `employee_id`, `month`, `base_salary`, `allowance`, `bonus`, `deduction`, `net_salary`, `payment_date`, `payment_method`, `transaction_no`, `status`, `note`, `created_by`, `created_at`) VALUES
(1, 1, '0000-00-00', '20000.00', '0.00', '0.00', '0.00', '20000.00', '2026-07-27', 'cash', '', 'draft', '', 1, '2026-07-27 05:23:30'),
(2, 1, '0000-00-00', '12000.00', '0.00', '0.00', '0.00', '12000.00', '2026-07-27', 'cash', '125462', 'paid', 'asdad', 1, '2026-07-27 05:24:17'),
(3, 1, '2026-07-01', '10000.00', '0.00', '0.00', '100.00', '9900.00', '2026-07-27', 'cash', '', 'draft', '', 1, '2026-07-27 08:49:31');

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` int(11) NOT NULL,
  `expense_no` varchar(50) NOT NULL,
  `category` varchar(100) NOT NULL,
  `vendor_id` int(11) DEFAULT NULL,
  `po_id` int(11) DEFAULT NULL,
  `description` text NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','bank','bkash','nagad','rocket','card','other') DEFAULT 'cash',
  `reference_no` varchar(100) DEFAULT NULL,
  `expense_date` date NOT NULL,
  `note` 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;

--
-- Dumping data for table `expenses`
--

INSERT INTO `expenses` (`id`, `expense_no`, `category`, `vendor_id`, `po_id`, `description`, `amount`, `payment_method`, `reference_no`, `expense_date`, `note`, `created_by`, `created_at`) VALUES
(1, 'EXP-20260727-4057', 'asd', 2, NULL, 'Convence', '2333.00', 'cash', 'adasd', '2026-07-27', 'sdaf', 1, '2026-07-27 05:40:28');

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

--
-- Table structure for table `income`
--

CREATE TABLE `income` (
  `id` int(11) NOT NULL,
  `income_no` varchar(50) NOT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `order_id` int(11) DEFAULT NULL,
  `customer_name` varchar(255) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','bank','bkash','nagad','rocket','card','other') DEFAULT 'cash',
  `reference_no` varchar(100) DEFAULT NULL,
  `payment_date` date NOT NULL,
  `note` text DEFAULT NULL,
  `received_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `income`
--

INSERT INTO `income` (`id`, `income_no`, `invoice_id`, `order_id`, `customer_name`, `amount`, `payment_method`, `reference_no`, `payment_date`, `note`, `received_by`, `created_at`) VALUES
(1, 'INC-20260724-1377', NULL, NULL, 'WordPress Web', '1000.00', 'cash', '', '2026-07-24', 'gg', NULL, '2026-07-24 14:20:40');

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

--
-- Table structure for table `inventory`
--

CREATE TABLE `inventory` (
  `id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `quantity` int(11) DEFAULT 0,
  `min_stock` int(11) DEFAULT 5,
  `max_stock` int(11) DEFAULT 100,
  `reorder_level` int(11) DEFAULT 10,
  `location` varchar(100) DEFAULT NULL,
  `last_updated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `invoice_no` varchar(50) NOT NULL,
  `order_id` int(11) DEFAULT NULL,
  `customer_name` varchar(255) NOT NULL,
  `customer_email` varchar(100) DEFAULT NULL,
  `customer_phone` varchar(20) DEFAULT NULL,
  `customer_address` text DEFAULT NULL,
  `invoice_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `subtotal` decimal(10,2) DEFAULT 0.00,
  `tax` decimal(10,2) DEFAULT 0.00,
  `discount` decimal(10,2) DEFAULT 0.00,
  `total` decimal(10,2) DEFAULT 0.00,
  `paid_amount` decimal(10,2) DEFAULT 0.00,
  `due_amount` decimal(10,2) DEFAULT 0.00,
  `status` enum('draft','sent','paid','partial','overdue','cancelled') DEFAULT 'draft',
  `note` 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;

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

INSERT INTO `invoices` (`id`, `invoice_no`, `order_id`, `customer_name`, `customer_email`, `customer_phone`, `customer_address`, `invoice_date`, `due_date`, `subtotal`, `tax`, `discount`, `total`, `paid_amount`, `due_amount`, `status`, `note`, `created_by`, `created_at`) VALUES
(2, 'INV-20260723-7268', NULL, 'rasel', 'work.smrasel@gmail.com', '01764197001', '', '2026-07-23', '2026-08-22', '2000.00', '0.00', '0.00', '2000.00', '0.00', '0.00', 'draft', '', 1, '2026-07-23 16:31:01');

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

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

CREATE TABLE `orders` (
  `id` int(11) NOT NULL,
  `invoice_no` varchar(50) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `email` varchar(100) DEFAULT NULL,
  `address` text NOT NULL,
  `city` varchar(100) DEFAULT NULL,
  `subcity` varchar(100) DEFAULT NULL,
  `note` text DEFAULT NULL,
  `subtotal` decimal(10,2) NOT NULL,
  `shipping_charge` decimal(10,2) DEFAULT 0.00,
  `discount` decimal(10,2) DEFAULT 0.00,
  `total` decimal(10,2) NOT NULL,
  `payment_method` varchar(50) DEFAULT 'cod',
  `payment_status` enum('pending','paid','failed') DEFAULT 'pending',
  `order_status` enum('pending','processing','shipped','delivered','cancelled') DEFAULT 'pending',
  `coupon_code` varchar(50) DEFAULT NULL,
  `coupon_discount` decimal(10,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `orders` (`id`, `invoice_no`, `user_id`, `customer_id`, `name`, `phone`, `email`, `address`, `city`, `subcity`, `note`, `subtotal`, `shipping_charge`, `discount`, `total`, `payment_method`, `payment_status`, `order_status`, `coupon_code`, `coupon_discount`, `created_at`) VALUES
(1, 'INV-20260721-6A5F98855FA0B', 1, NULL, 'rasel', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'asdaf', '500.00', '70.00', '0.00', '550.00', 'cod', 'pending', 'pending', NULL, '0.00', '2026-07-21 16:04:21'),
(2, 'INV-20260721-6A5FA98BED8EC', 1, NULL, 'Amin', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'fgh', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:16:59'),
(3, 'INV-20260721-6A5FA99D72068', 1, NULL, 'Amin', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'fgh', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:17:17'),
(4, 'INV-20260721-6A5FAAB32E91C', 1, NULL, 'Amin', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'bcvn', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:21:55'),
(5, 'INV-20260721-6A5FAB3BAB63C', 1, 2, 'Admin', '01764197011', NULL, 'tg,ggg', NULL, NULL, '', '500.00', '70.00', '0.00', '550.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:24:11'),
(6, 'INV-20260721-6A5FADBFE8EAD', 1, NULL, 'dd', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'ddd', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:34:55'),
(7, 'INV-20260721-6A5FAEC38994A', 1, NULL, 'ff', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'ff', '500.00', '70.00', '0.00', '550.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:39:15'),
(8, 'INV-20260721-6A5FAF599931D', 1, NULL, 'ff', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'ff', '500.00', '70.00', '0.00', '550.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:41:45'),
(9, 'INV-20260721-6A5FAFBF50696', 0, NULL, '', '', '', '', '', NULL, '', '0.00', '0.00', '0.00', '0.00', 'cod', 'pending', 'pending', NULL, '0.00', '2026-07-21 17:43:27'),
(10, 'INV-20260721-6A5FB0C0218E6', 1, NULL, 'rasel', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'asdaf', '500.00', '70.00', '0.00', '550.00', 'cod', 'pending', 'pending', NULL, '0.00', '2026-07-21 17:47:44'),
(11, 'INV-20260721-6A5FB354B9850', 1, NULL, 'rasel', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'dd', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-21 17:58:44'),
(12, 'INV-20260722-6A60F265E60CB', 2, NULL, 'rasel', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'asdaf', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'processing', '', '0.00', '2026-07-22 16:40:05'),
(13, 'INV-20260722-6A60F2F5CF04C', 2, NULL, 'rasel', '01764197001', NULL, 'fgdsfgdhggh fgdg', NULL, NULL, 'gdsfggf', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'delivered', '', '0.00', '2026-07-22 16:42:29'),
(14, 'INV-20260722-6A60F9916B34C', 2, NULL, 'rasel', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'dgf', '1000.00', '70.00', '0.00', '1050.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-22 17:10:41'),
(15, 'INV-20260724-6A6342533716D', 2, NULL, 'rasel', '01764197001', NULL, 'tg,ggg', NULL, NULL, 'fcnf', '1000.00', '70.00', '0.00', '1070.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-24 10:45:39'),
(16, 'INV-20260726-6A659061C457E', 2, NULL, 'rasel', '01764197001', NULL, '334/A', NULL, NULL, '', '1900.00', '120.00', '0.00', '2020.00', 'cod', 'pending', 'processing', '', '0.00', '2026-07-26 04:43:13'),
(17, 'INV-20260726-6A65916B2ED62', 2, NULL, 'rasel', '01764197001', NULL, 'ddfdf', NULL, NULL, 'xv', '1900.00', '100.00', '0.00', '2000.00', 'cod', 'pending', 'processing', '', '0.00', '2026-07-26 04:47:39'),
(18, 'INV-20260727-6A67608191F11', 2, NULL, 'rasel', '01764197001', NULL, 'sfdgdsgf', NULL, NULL, 'xgdh', '1900.00', '100.00', '0.00', '2000.00', 'cod', 'pending', 'pending', '', '0.00', '2026-07-27 13:43:29');

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

--
-- 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) NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_code` varchar(50) DEFAULT NULL,
  `attributes` text DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `total` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_code`, `attributes`, `quantity`, `price`, `total`) VALUES
(1, 1, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', NULL, 1, '500.00', '500.00'),
(2, 2, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', NULL, 2, '500.00', '1000.00'),
(3, 3, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', NULL, 2, '500.00', '1000.00'),
(4, 4, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', NULL, 2, '500.00', '1000.00'),
(5, 5, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', NULL, 1, '500.00', '500.00'),
(6, 6, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"M\"}', 2, '500.00', '1000.00'),
(7, 7, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"XL\"}', 1, '500.00', '500.00'),
(8, 8, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"XL\"}', 1, '500.00', '500.00'),
(9, 9, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', NULL, '[]', 3, '500.00', '1500.00'),
(10, 9, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', NULL, '{\"Size\":\"XL\"}', 2, '500.00', '1000.00'),
(11, 10, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"XL\"}', 1, '500.00', '500.00'),
(12, 11, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"XL\"}', 2, '500.00', '1000.00'),
(13, 12, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"XL\"}', 2, '500.00', '1000.00'),
(14, 13, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', '{\"Size\":\"XL\"}', 2, '500.00', '1000.00'),
(15, 14, 1, 'Oxford Cotton Febric Long Sleeve Katua _ Sky _ Ash _ Black', 'P-20260721-7586', NULL, 2, '500.00', '1000.00'),
(16, 15, 2, 'Katua', 'P-20260722-7073', '{\"Size\":\"XL\"}', 2, '500.00', '1000.00'),
(17, 16, 11, 'Nowshin three pc', 'P-20260724-9157', NULL, 1, '1900.00', '1900.00'),
(18, 17, 11, 'Nowshin three pc', 'P-20260724-9157', '{\"Size\":\"XL\"}', 1, '1900.00', '1900.00'),
(19, 18, 10, 'Nowshin three pc', 'P-20260724-7812', '{\"Size\":\"XL\"}', 1, '1900.00', '1900.00');

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

--
-- Table structure for table `po_items`
--

CREATE TABLE `po_items` (
  `id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `product_id` int(11) DEFAULT NULL,
  `item_name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `total` decimal(10,2) NOT NULL,
  `received_qty` int(11) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `po_items`
--

INSERT INTO `po_items` (`id`, `po_id`, `product_id`, `item_name`, `description`, `quantity`, `unit_price`, `total`, `received_qty`, `created_at`) VALUES
(1, 5, NULL, 'afsg', 'afsg', 1, '1000.00', '1000.00', 0, '2026-07-26 10:13:02'),
(2, 6, NULL, 'ssa', 'ssa', 1, '2000.00', '2000.00', 0, '2026-07-26 10:15:49');

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

--
-- Table structure for table `po_payments`
--

CREATE TABLE `po_payments` (
  `id` int(11) NOT NULL,
  `payment_no` varchar(50) NOT NULL,
  `po_id` int(11) NOT NULL,
  `vendor_id` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `payment_method` enum('cash','bank','bkash','nagad','rocket','card','other') DEFAULT 'cash',
  `reference_no` varchar(100) DEFAULT NULL,
  `payment_date` date NOT NULL,
  `note` 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;

--
-- Dumping data for table `po_payments`
--

INSERT INTO `po_payments` (`id`, `payment_no`, `po_id`, `vendor_id`, `amount`, `payment_method`, `reference_no`, `payment_date`, `note`, `created_by`, `created_at`) VALUES
(1, 'PPMT-20260726-4565', 5, 1, '1000.00', 'cash', 'dfs', '2026-07-26', 'fdsf', 1, '2026-07-26 10:13:36');

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

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

CREATE TABLE `products` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `subcategory_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `product_code` varchar(50) NOT NULL,
  `sku` varchar(100) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `specification` text DEFAULT NULL,
  `price` decimal(10,2) NOT NULL,
  `sale_price` decimal(10,2) DEFAULT NULL,
  `stock` int(11) DEFAULT 0,
  `min_stock` int(11) DEFAULT 5,
  `max_stock` int(11) DEFAULT 100,
  `reorder_level` int(11) DEFAULT 10,
  `image` varchar(255) DEFAULT NULL,
  `gallery_images` text DEFAULT NULL,
  `featured` tinyint(1) DEFAULT 0,
  `new` tinyint(1) DEFAULT 0,
  `top_selling` tinyint(1) DEFAULT 0,
  `status` tinyint(1) DEFAULT 1,
  `views` int(11) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `products` (`id`, `category_id`, `subcategory_id`, `name`, `slug`, `product_code`, `sku`, `description`, `specification`, `price`, `sale_price`, `stock`, `min_stock`, `max_stock`, `reorder_level`, `image`, `gallery_images`, `featured`, `new`, `top_selling`, `status`, `views`, `created_at`) VALUES
(1, 5, NULL, 'Shart', 'oxford-cotton-febric-long-sleeve-katua-sky-ash-black', 'P-20260721-7586', NULL, '100% Oxford Cotton Fabrics\r\nExport Quality Swing \r\nColor and quality 100% guarantee\r\nComfortable for every season\r\nOne Pocket\r\nSlim Fit\r\n\r\nSize: M, L, XL, XXL', '100% Oxford Cotton Fabrics\r\nExport Quality Swing \r\nColor and quality 100% guarantee\r\nComfortable for every season\r\nOne Pocket', '500.00', '500.00', 10, 5, 100, 10, '1784643283_6a5f7ed373a8d.webp', NULL, 1, 1, 0, 1, 55, '2026-07-21 14:14:43'),
(2, 7, NULL, 'Katua', 'katua', 'P-20260722-7073', NULL, 'Product Type: Katua\r\nGender: Men&#039;s\r\nMaterial: 100% SATIN COTTON FABRIC\r\nHigh Quality Material\r\nSwing: Export Quality\r\nPocket: No\r\nComfortable and Soft\r\nColor and quality 100% guarantee\r\nFashionable and comfortable for every season\r\nSize: M, L, XL, XXL\r\n\r\nM  = Length: 28”- Chest: 40”\r\nL   = Length: 29” -Chest: 42”\r\nXL  = Length: 30”-Chest: 44”\r\nXXL = Lenght 31”- Chest- 46”', '', '500.00', '500.00', 10, 5, 100, 10, '1784739600_6a60f710859d3.webp', NULL, 1, 1, 1, 1, 6, '2026-07-22 17:00:00'),
(3, 13, NULL, 'Shoe', 'shoe', 'P-20260723-4349', NULL, 'free size', 'dsfsdf', '1000.00', '1000.00', 0, 5, 100, 10, '1784806208_6a61fb40d033e.jpg', NULL, 1, 1, 1, 1, 5, '2026-07-23 11:30:08'),
(4, 3, NULL, 'Pant', 'pant', 'P-20260723-3704', NULL, '', '', '1200.00', '1100.00', 20, 5, 100, 10, '1784806423_6a61fc175075d.jpg', NULL, 1, 1, 1, 1, 3, '2026-07-23 11:33:43'),
(5, 2, NULL, 'Jaket', 'jaket', 'P-20260723-7912', NULL, 'sdafa', 'sdfsf', '2500.00', '1900.00', 10, 5, 100, 10, '1784806488_6a61fc5881ff8.jpg', NULL, 1, 1, 1, 1, 4, '2026-07-23 11:34:48'),
(6, 4, NULL, 'Fashion Sandals', 'fashion-sandals', 'P-20260723-2883', NULL, 'Leader', 'ghjdj fghdfh', '1400.00', '1200.00', 20, 5, 100, 10, '1784806711_6a61fd37158ba.jpg', NULL, 1, 0, 0, 1, 3, '2026-07-23 11:38:31'),
(7, 14, NULL, 'Three Piece', 'three-piece', 'P-20260724-3641', NULL, '100% Cotton', '', '1200.00', '1000.00', 10, 5, 100, 10, '1784890886_6a634606ba107.jpg', NULL, 1, 1, 0, 1, 0, '2026-07-24 11:01:26'),
(8, 14, NULL, 'Three Piece', 'three-piece-1784890958', 'P-20260724-1643', NULL, '100% cotton', '', '1200.00', '1000.00', 10, 5, 100, 10, '1784890958_6a63464e415c2.jpg', NULL, 1, 1, 0, 1, 1, '2026-07-24 11:02:38'),
(9, 14, NULL, 'Three Piece', 'three-piece-1784890992', 'P-20260724-9309', NULL, '100% cotton', '', '1200.00', '1000.00', 10, 5, 100, 10, '1784890992_6a6346703f9d9.jpg', NULL, 1, 1, 0, 1, 1, '2026-07-24 11:03:12'),
(10, 15, NULL, 'Nowshin three pc', 'nowshin-three-pc', 'P-20260724-7812', NULL, 'Latest Luxury Haute Collection \r\n\r\nFARHA is a Beautiful velvet abaya with stunning sleeve embroidery, with a delicate silk inner and scarf\r\n\r\nAbaya, inner and scarf included', '', '2200.00', '1900.00', 10, 5, 100, 10, '1784891363_6a6347e366a91.jpg', NULL, 1, 1, 0, 1, 27, '2026-07-24 11:09:23'),
(11, 15, NULL, 'Nowshin three pc', 'nowshin-three-pc-1784891414', 'P-20260724-9157', NULL, 'Latest Luxury Haute Collection \r\n\r\nFARHA is a Beautiful velvet abaya with stunning sleeve embroidery, with a delicate silk inner and scarf\r\n\r\nAbaya, inner and scarf included', '', '2200.00', '1900.00', 10, 5, 100, 10, '1784891414_6a6348165e2bd.jpg', NULL, 1, 1, 1, 1, 22, '2026-07-24 11:10:14'),
(12, 16, NULL, 'Suit', 'suit', 'P-20260724-8722', NULL, 'Brown Three Piece Suit for Men Wedding Party Wear,', 'Brown Three Piece Suit for Men Wedding Party Wear,', '5000.00', '4500.00', 10, 5, 100, 10, '1784891575_6a6348b78c9b5.jpg', NULL, 1, 0, 0, 1, 17, '2026-07-24 11:12:55');

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

--
-- Table structure for table `product_attributes`
--

CREATE TABLE `product_attributes` (
  `id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `attribute_name` varchar(100) NOT NULL,
  `attribute_value` varchar(255) NOT NULL,
  `extra_price` decimal(10,2) DEFAULT 0.00,
  `stock` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `purchase_orders`
--

CREATE TABLE `purchase_orders` (
  `id` int(11) NOT NULL,
  `po_no` varchar(50) NOT NULL,
  `vendor_id` int(11) NOT NULL,
  `order_date` date NOT NULL,
  `delivery_date` date DEFAULT NULL,
  `subtotal` decimal(10,2) DEFAULT 0.00,
  `tax` decimal(10,2) DEFAULT 0.00,
  `discount` decimal(10,2) DEFAULT 0.00,
  `total` decimal(10,2) DEFAULT 0.00,
  `paid_amount` decimal(10,2) DEFAULT 0.00,
  `due_amount` decimal(10,2) DEFAULT 0.00,
  `status` enum('draft','pending','approved','received','partial','paid','cancelled') DEFAULT 'draft',
  `note` 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;

--
-- Dumping data for table `purchase_orders`
--

INSERT INTO `purchase_orders` (`id`, `po_no`, `vendor_id`, `order_date`, `delivery_date`, `subtotal`, `tax`, `discount`, `total`, `paid_amount`, `due_amount`, `status`, `note`, `created_by`, `created_at`) VALUES
(5, 'PO-20260726-6833', 1, '2026-07-26', '2026-07-31', '1000.00', '0.00', '0.00', '1000.00', '1000.00', '0.00', 'paid', '', 1, '2026-07-26 10:13:02'),
(6, 'PO-20260726-8276', 2, '2026-07-26', '2026-07-30', '2000.00', '0.00', '0.00', '2000.00', '0.00', '2000.00', 'draft', '', 1, '2026-07-26 10:15:49');

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

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `key` varchar(100) NOT NULL,
  `value` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` (`id`, `key`, `value`, `created_at`) VALUES
(1, 'site_name', 'SellBazar', '2026-07-19 15:38:57'),
(2, 'site_logo', 'logo.png', '2026-07-19 15:38:57'),
(3, 'site_favicon', 'favicon.ico', '2026-07-19 15:38:58'),
(4, 'meta_description', 'SellBazar - Your Online Shopping Store', '2026-07-19 15:38:58'),
(5, 'meta_keywords', 'ecommerce, online shop, sellbazar', '2026-07-19 15:38:58'),
(6, 'facebook_pixel_id', '', '2026-07-19 15:38:58'),
(7, 'footer_text', 'SellBazar © All Rights Reserved', '2026-07-19 15:38:58'),
(8, 'shipping_charge', '50', '2026-07-19 15:38:58'),
(9, 'site_email', 'info@sellbazar.com', '2026-07-19 15:38:58'),
(10, 'site_phone', '+8801234567890', '2026-07-19 15:38:58'),
(11, 'address', 'Dhaka, Bangladesh', '2026-07-19 15:38:58');

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

--
-- Table structure for table `shipments`
--

CREATE TABLE `shipments` (
  `id` int(11) NOT NULL,
  `shipment_no` varchar(50) NOT NULL,
  `order_id` int(11) DEFAULT NULL,
  `invoice_no` varchar(50) DEFAULT NULL,
  `customer_name` varchar(255) NOT NULL,
  `customer_phone` varchar(20) NOT NULL,
  `customer_address` text NOT NULL,
  `city` varchar(100) DEFAULT NULL,
  `shipping_method` enum('courier','self_delivery','postal','other') DEFAULT 'courier',
  `courier_name` varchar(100) DEFAULT NULL,
  `tracking_no` varchar(100) DEFAULT NULL,
  `weight` decimal(10,2) DEFAULT 0.00,
  `shipping_cost` decimal(10,2) DEFAULT 0.00,
  `delivery_date` date DEFAULT NULL,
  `status` enum('pending','processing','picked','in_transit','out_for_delivery','delivered','returned','cancelled') DEFAULT 'pending',
  `note` 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;

--
-- Dumping data for table `shipments`
--

INSERT INTO `shipments` (`id`, `shipment_no`, `order_id`, `invoice_no`, `customer_name`, `customer_phone`, `customer_address`, `city`, `shipping_method`, `courier_name`, `tracking_no`, `weight`, `shipping_cost`, `delivery_date`, `status`, `note`, `created_by`, `created_at`) VALUES
(2, 'SHIP-20260726-1574', 17, NULL, 'NJ &amp; Daymond', '01764197001', 'Post Office: Komlapur, Upazila: Kumarkhali, District: Kushtia, Bangladesh. EIIN No.: 117691', 'Kushtia', 'courier', 'SA Paribahan', '', '2.00', '20.00', '2026-07-27', 'processing', 'df', 1, '2026-07-26 10:31:25');

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

--
-- Table structure for table `shipment_tracking`
--

CREATE TABLE `shipment_tracking` (
  `id` int(11) NOT NULL,
  `shipment_id` int(11) NOT NULL,
  `status` varchar(50) NOT NULL,
  `location` varchar(255) DEFAULT NULL,
  `description` 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;

--
-- Dumping data for table `shipment_tracking`
--

INSERT INTO `shipment_tracking` (`id`, `shipment_id`, `status`, `location`, `description`, `created_by`, `created_at`) VALUES
(3, 2, 'processing', NULL, 'Shipment created', 1, '2026-07-26 10:31:25');

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

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

CREATE TABLE `stock_movements` (
  `id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `type` enum('purchase','sale','return','adjustment','transfer') NOT NULL,
  `quantity` int(11) NOT NULL,
  `previous_quantity` int(11) DEFAULT 0,
  `new_quantity` int(11) DEFAULT 0,
  `reference_no` varchar(50) DEFAULT NULL,
  `note` 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 `subcategories`
--

CREATE TABLE `subcategories` (
  `id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `role` enum('admin','user') DEFAULT 'user',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `name`, `email`, `phone`, `password`, `address`, `city`, `role`, `created_at`) VALUES
(1, 'Admin', 'admin@sellbazar.com', NULL, '$2y$10$H1COJ6xqtd.lWLVeumg2CuB4HKP5hAxFzo4CTgsiciXjuKQHevup6', NULL, NULL, 'admin', '2026-07-19 15:38:57'),
(2, 'rasel', 'work.smrasel@gmail.com', '01764197001', '$2y$10$oyBxqDtIWhnA.4NgRzerFeJ5W/nnudp2kRhjWdgM5u1wciTX5Q5X.', NULL, NULL, 'user', '2026-07-22 16:39:09');

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

--
-- Table structure for table `vendors`
--

CREATE TABLE `vendors` (
  `id` int(11) NOT NULL,
  `vendor_code` varchar(50) NOT NULL,
  `name` varchar(255) NOT NULL,
  `company` varchar(255) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `tax_id` varchar(50) DEFAULT NULL,
  `opening_balance` decimal(10,2) DEFAULT 0.00,
  `payment_terms` varchar(50) DEFAULT 'net30',
  `status` tinyint(1) DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vendors`
--

INSERT INTO `vendors` (`id`, `vendor_code`, `name`, `company`, `email`, `phone`, `address`, `city`, `tax_id`, `opening_balance`, `payment_terms`, `status`, `created_at`) VALUES
(1, 'VND-20260726-8802', 'Shekh Md Rasel', 'Al Jaami Technologies', 'work.smrasel@gmail.com', '+8801764197001', '334/A', 'Kushtia', '', '1000.00', 'net30', 1, '2026-07-26 04:51:06'),
(2, 'VND-20260726-9654', 'Md. Tamin Yousuf', '01757909110', 'milonpaharpur@gmail.com', '+8801757909243', 'Courtpara', 'Kushtia', '', '2000.00', 'cod', 1, '2026-07-26 10:15:09');

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

--
-- Table structure for table `withdrawals`
--

CREATE TABLE `withdrawals` (
  `id` int(11) NOT NULL,
  `withdrawal_no` varchar(50) NOT NULL,
  `account_id` int(11) DEFAULT NULL,
  `amount` decimal(10,2) NOT NULL,
  `withdrawal_date` date NOT NULL,
  `payment_method` enum('cash','bank','bkash','nagad','rocket','card','other') DEFAULT 'cash',
  `reference_no` varchar(100) DEFAULT NULL,
  `purpose` varchar(255) DEFAULT NULL,
  `note` 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;

--
-- Dumping data for table `withdrawals`
--

INSERT INTO `withdrawals` (`id`, `withdrawal_no`, `account_id`, `amount`, `withdrawal_date`, `payment_method`, `reference_no`, `purpose`, `note`, `created_by`, `created_at`) VALUES
(1, 'WTH-20260727-6510', 1, '22222.00', '2026-07-27', 'cash', '', '', '', 1, '2026-07-27 14:19:40');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `account_transactions`
--
ALTER TABLE `account_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `account_id` (`account_id`);

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

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

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

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

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

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

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

--
-- Indexes for table `delivery_reports`
--
ALTER TABLE `delivery_reports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `report_no` (`report_no`),
  ADD KEY `order_id` (`order_id`),
  ADD KEY `invoice_no` (`invoice_no`);

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

--
-- Indexes for table `deposits`
--
ALTER TABLE `deposits`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `deposit_no` (`deposit_no`),
  ADD KEY `account_id` (`account_id`);

--
-- Indexes for table `designations`
--
ALTER TABLE `designations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `department_id` (`department_id`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `employee_code` (`employee_code`),
  ADD UNIQUE KEY `email` (`email`);

--
-- Indexes for table `employee_attendance`
--
ALTER TABLE `employee_attendance`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `employee_date` (`employee_id`,`date`);

--
-- Indexes for table `employee_leaves`
--
ALTER TABLE `employee_leaves`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_id` (`employee_id`);

--
-- Indexes for table `employee_salaries`
--
ALTER TABLE `employee_salaries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_id` (`employee_id`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `expense_no` (`expense_no`),
  ADD KEY `vendor_id` (`vendor_id`),
  ADD KEY `po_id` (`po_id`);

--
-- Indexes for table `income`
--
ALTER TABLE `income`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `income_no` (`income_no`),
  ADD KEY `invoice_id` (`invoice_id`),
  ADD KEY `order_id` (`order_id`);

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

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

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `invoice_no` (`invoice_no`),
  ADD KEY `orders_ibfk_customer` (`customer_id`);

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

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

--
-- Indexes for table `po_payments`
--
ALTER TABLE `po_payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payment_no` (`payment_no`),
  ADD KEY `po_id` (`po_id`),
  ADD KEY `vendor_id` (`vendor_id`);

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

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

--
-- Indexes for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `po_no` (`po_no`),
  ADD KEY `vendor_id` (`vendor_id`);

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

--
-- Indexes for table `shipments`
--
ALTER TABLE `shipments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `shipment_no` (`shipment_no`),
  ADD KEY `order_id` (`order_id`),
  ADD KEY `invoice_no` (`invoice_no`);

--
-- Indexes for table `shipment_tracking`
--
ALTER TABLE `shipment_tracking`
  ADD PRIMARY KEY (`id`),
  ADD KEY `shipment_id` (`shipment_id`);

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

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

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

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

--
-- Indexes for table `withdrawals`
--
ALTER TABLE `withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `withdrawal_no` (`withdrawal_no`),
  ADD KEY `account_id` (`account_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `account_transactions`
--
ALTER TABLE `account_transactions`
  ADD CONSTRAINT `account_transactions_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `delivery_reports`
--
ALTER TABLE `delivery_reports`
  ADD CONSTRAINT `delivery_reports_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `deposits`
--
ALTER TABLE `deposits`
  ADD CONSTRAINT `deposits_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `designations`
--
ALTER TABLE `designations`
  ADD CONSTRAINT `designations_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `employee_attendance`
--
ALTER TABLE `employee_attendance`
  ADD CONSTRAINT `employee_attendance_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employee_leaves`
--
ALTER TABLE `employee_leaves`
  ADD CONSTRAINT `employee_leaves_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employee_salaries`
--
ALTER TABLE `employee_salaries`
  ADD CONSTRAINT `employee_salaries_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_ibfk_2` FOREIGN KEY (`po_id`) REFERENCES `purchase_orders` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `income`
--
ALTER TABLE `income`
  ADD CONSTRAINT `income_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `income_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `inventory`
--
ALTER TABLE `inventory`
  ADD CONSTRAINT `inventory_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL;

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

--
-- 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 `po_items`
--
ALTER TABLE `po_items`
  ADD CONSTRAINT `po_items_ibfk_1` FOREIGN KEY (`po_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `po_items_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `po_payments`
--
ALTER TABLE `po_payments`
  ADD CONSTRAINT `po_payments_ibfk_1` FOREIGN KEY (`po_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `po_payments_ibfk_2` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`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,
  ADD CONSTRAINT `products_ibfk_2` FOREIGN KEY (`subcategory_id`) REFERENCES `subcategories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `product_attributes`
--
ALTER TABLE `product_attributes`
  ADD CONSTRAINT `product_attributes_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD CONSTRAINT `purchase_orders_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `shipments`
--
ALTER TABLE `shipments`
  ADD CONSTRAINT `shipments_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `shipment_tracking`
--
ALTER TABLE `shipment_tracking`
  ADD CONSTRAINT `shipment_tracking_ibfk_1` FOREIGN KEY (`shipment_id`) REFERENCES `shipments` (`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;

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

--
-- Constraints for table `withdrawals`
--
ALTER TABLE `withdrawals`
  ADD CONSTRAINT `withdrawals_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `bank_accounts` (`id`) ON DELETE SET NULL;
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 */;
