-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 18, 2026 at 12:44 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.0.30

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


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

--
-- Database: `shivram`
--

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

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'admin', 'admin');

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

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

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

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

INSERT INTO `categories` (`id`, `category_name`) VALUES
(1, 'LOWER'),
(2, 'NIKKAR'),
(3, 'CAPRI'),
(4, 'test'),
(5, 'Capri'),
(6, 'cotton'),
(7, 'Jeans');

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

--
-- Table structure for table `colors`
--

CREATE TABLE `colors` (
  `id` int(11) NOT NULL,
  `color_name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `colors`
--

INSERT INTO `colors` (`id`, `color_name`) VALUES
(1, 'mix'),
(2, 'red'),
(3, 'Navy Blue'),
(4, 'cream'),
(5, 'black'),
(6, 'white');

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

--
-- Table structure for table `direct_production`
--

CREATE TABLE `direct_production` (
  `id` int(11) NOT NULL,
  `production_id` varchar(20) NOT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `contact_number` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `gst_number` varchar(50) DEFAULT NULL,
  `product_id` int(11) DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `category_id` int(11) DEFAULT NULL,
  `sub_category_id` int(11) DEFAULT NULL,
  `color_id` int(11) DEFAULT NULL,
  `custom_color` varchar(100) DEFAULT NULL,
  `fabric_id` int(11) DEFAULT NULL,
  `selected_sizes` varchar(255) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `status` enum('Pending','In-Progress','Completed') DEFAULT 'Pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `sample_images_json` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `direct_production`
--

INSERT INTO `direct_production` (`id`, `production_id`, `customer_name`, `contact_number`, `address`, `gst_number`, `product_id`, `product_name`, `category_id`, `sub_category_id`, `color_id`, `custom_color`, `fabric_id`, `selected_sizes`, `message`, `status`, `created_at`, `sample_images_json`) VALUES
(1, 'PROD-26036', NULL, NULL, NULL, NULL, NULL, 'half shirt', 6, 6, NULL, '', 1, 'S, M, L', 'Testing', 'Pending', '2026-03-02 18:25:14', NULL),
(2, 'PROD-42667', 'test', '6201403690', 'Hirapur Telipara road', 'WEDF1234WD', 1, 'test', 2, NULL, NULL, '1', 1, 'S', 'test', 'Pending', '2026-03-07 10:36:43', NULL),
(3, 'PROD-65871', NULL, NULL, NULL, NULL, 13, 'Cotton T-shirt', 4, NULL, NULL, '1', 1, 'S, M, L, XL', 'test', 'Pending', '2026-03-12 10:51:37', '[\"SAMPLE_1773312697_images (1).jpg\",\"SAMPLE_1773312697_CottonKing.04.01.20242096.jpg\"]');

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

--
-- Table structure for table `fabrics`
--

CREATE TABLE `fabrics` (
  `id` int(11) NOT NULL,
  `material_name` varchar(255) NOT NULL,
  `stock_qty` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `fabrics`
--

INSERT INTO `fabrics` (`id`, `material_name`, `stock_qty`) VALUES
(1, 'CLOTH 2 THREAD (SPUN)', 20),
(2, 'CLOTH COTTON LYCRA', 15),
(3, 'CLOTH NS', 20),
(4, 'button', 10);

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

--
-- Table structure for table `internal_production_logs`
--

CREATE TABLE `internal_production_logs` (
  `id` int(11) NOT NULL,
  `order_code` varchar(50) DEFAULT NULL,
  `product_id` int(11) DEFAULT NULL,
  `product_name` varchar(255) DEFAULT NULL,
  `sent_qty` int(11) DEFAULT NULL,
  `status` varchar(50) DEFAULT 'In-Production',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `raw_materials_json` longtext DEFAULT NULL COMMENT 'Snapshot of materials used at time of kitting',
  `production_type` enum('sales_order','direct') DEFAULT 'sales_order',
  `material_details_json` text DEFAULT NULL,
  `kitting_proofs_json` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `internal_production_logs`
--

INSERT INTO `internal_production_logs` (`id`, `order_code`, `product_id`, `product_name`, `sent_qty`, `status`, `created_at`, `raw_materials_json`, `production_type`, `material_details_json`, `kitting_proofs_json`) VALUES
(1, 'STO-24263', NULL, 'Black Tshirt', 500, 'In-Production', '2026-03-07 08:25:25', NULL, 'sales_order', NULL, NULL),
(2, 'STO-32455', 15, 'Denim Jackets', 50, 'In-Production', '2026-03-10 09:00:00', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":500,\"current\":\"500.00\"},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":500,\"current\":\"500.00\"}]', NULL),
(3, 'STO-32455', 15, 'Denim Jackets', 100, 'Partial-Kitting', '2026-03-12 08:03:12', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":1000,\"sent\":\"20.00\",\"pending\":980},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":1000,\"sent\":\"120.00\",\"pending\":880}]', NULL),
(4, 'STO-68215', 16, 'Leg-jeans', 50, 'Partial-Kitting', '2026-03-12 08:18:49', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":250,\"sent\":\"100.00\",\"pending\":150},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":250,\"sent\":\"100.00\",\"pending\":150}]', NULL),
(5, 'STO-49584', 16, 'Leg-jeans', 60, 'Partial-Kitting', '2026-03-12 08:20:09', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":300,\"sent\":\"0.00\",\"pending\":300},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":300,\"sent\":\"0.00\",\"pending\":300}]', NULL),
(6, 'STO-37011', 15, 'Denim Jackets', 10, 'Partial-Kitting', '2026-03-12 08:56:48', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100}]', NULL),
(7, 'STO-37011', 15, 'Denim Jackets', 10, 'Partial-Kitting', '2026-03-12 10:40:40', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100}]', '[\"KIT_1773312040_istockphoto-1352728757-612x612.jpg\",\"KIT_1773312040_images.jpg\"]'),
(8, 'STO-37011', 15, 'Denim Jackets', 10, 'Partial-Kitting', '2026-03-12 10:44:10', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100}]', '[\"KIT_1773312250_istockphoto-1352728757-612x612.jpg\",\"KIT_1773312250_images.jpg\"]'),
(9, 'STO-37011', 15, 'Denim Jackets', 10, 'Partial-Kitting', '2026-03-12 12:41:56', NULL, 'sales_order', '[{\"id\":1,\"name\":\"Button\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100}]', '[\"KIT_1773319316_9F5A21824.JPG.jpeg\"]');

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

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

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `invoice_no` varchar(50) NOT NULL,
  `challan_no` varchar(20) NOT NULL,
  `customer_name` varchar(255) NOT NULL,
  `customer_contact` varchar(15) NOT NULL,
  `customer_email` varchar(100) DEFAULT NULL,
  `customer_address` text DEFAULT NULL,
  `customer_gst` varchar(20) DEFAULT NULL,
  `sub_total` decimal(15,2) NOT NULL,
  `tax_amount` decimal(15,2) NOT NULL,
  `final_amount` decimal(15,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `invoices` (`id`, `invoice_no`, `challan_no`, `customer_name`, `customer_contact`, `customer_email`, `customer_address`, `customer_gst`, `sub_total`, `tax_amount`, `final_amount`, `created_at`) VALUES
(1, 'SHF/SL/12354', '0001', 'Dipanshu Kumar Singh', '6201403960', '', 'India', '', 900.00, 162.00, 1062.00, '2026-02-28 14:18:19'),
(2, 'SHF/SL/12355', '0002', 'rahul singh', '6201403960', '', 'ASGDH', '', 4500.00, 810.00, 5310.00, '2026-02-28 14:24:55'),
(3, 'SHF/SL/12356', '0003', 'rahul singh', '6201403960', '', 'test', 'rfghj', 400.00, 72.00, 472.00, '2026-02-28 14:37:46'),
(4, 'SHF/SL/12357', '0004', 'D', '6201403690', '', 'dop', '', 4500.00, 810.00, 5310.00, '2026-03-02 18:57:26'),
(5, 'SHF/SL/12358', '0005', 'Raj Sing', '9800000000', '', 'Test', 'GF54FD', 6500.00, 1170.00, 7670.00, '2026-03-09 13:59:35');

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

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

CREATE TABLE `invoice_items` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `sku_code` varchar(100) NOT NULL,
  `qty` int(11) NOT NULL,
  `rate` decimal(15,2) NOT NULL,
  `amount` decimal(15,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `invoice_items` (`id`, `invoice_id`, `product_id`, `product_name`, `sku_code`, `qty`, `rate`, `amount`) VALUES
(1, 1, 7, 'Cargo ', 'CAR01', 2, 450.00, 900.00),
(2, 2, 7, 'Cargo ', 'CAR01', 10, 450.00, 4500.00),
(3, 3, 9, 'Jeans', 'JNS01', 1, 400.00, 400.00),
(4, 4, 7, 'Cargo ', 'CAR01', 10, 450.00, 4500.00),
(5, 5, 10, 'Black Tshirt', 'BK001', 10, 650.00, 6500.00);

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

--
-- Table structure for table `kitting_logs`
--

CREATE TABLE `kitting_logs` (
  `id` int(11) NOT NULL,
  `production_id` int(11) DEFAULT NULL,
  `material_id` int(11) DEFAULT NULL,
  `material_name` varchar(255) DEFAULT NULL,
  `required_qty` decimal(10,2) DEFAULT NULL,
  `available_stock` decimal(10,2) DEFAULT NULL,
  `status` enum('Available','Shortage') DEFAULT 'Available',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `product_master`
--

CREATE TABLE `product_master` (
  `id` int(11) NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `sku_code` varchar(100) NOT NULL,
  `product_type` enum('Raw Material','Finished Goods') NOT NULL DEFAULT 'Finished Goods',
  `unit_id` int(11) DEFAULT NULL,
  `category_id` int(11) DEFAULT NULL,
  `sub_category_id` int(11) DEFAULT NULL,
  `fabric_id` int(11) DEFAULT NULL,
  `color` varchar(50) DEFAULT NULL,
  `adc` int(11) DEFAULT 0,
  `lead_time` int(11) DEFAULT 0,
  `safety_stock` int(11) DEFAULT 0,
  `mfg_cost` decimal(10,2) DEFAULT 0.00,
  `selling_price` decimal(10,2) DEFAULT NULL,
  `opening_stock` int(11) DEFAULT 0,
  `batch_no` varchar(100) DEFAULT NULL,
  `recipe_json` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `color_id` int(11) DEFAULT NULL,
  `live_stock` int(11) DEFAULT 0,
  `product_images` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `product_master`
--

INSERT INTO `product_master` (`id`, `product_name`, `sku_code`, `product_type`, `unit_id`, `category_id`, `sub_category_id`, `fabric_id`, `color`, `adc`, `lead_time`, `safety_stock`, `mfg_cost`, `selling_price`, `opening_stock`, `batch_no`, `recipe_json`, `created_at`, `color_id`, `live_stock`, `product_images`) VALUES
(1, 'LOWER (AX LYCRA) 6404-G', '6404-G', 'Finished Goods', NULL, 2, 1, 1, 'mix', 0, 0, 0, 23.00, 34.00, 505, 'REF-270222026', '[{\"fabric_id\":\"1\",\"quantity\":\"1\"}]', '2026-02-24 12:44:41', NULL, 0, NULL),
(2, 'BOYS LOWER 901/20-36', '901/20-36', 'Finished Goods', NULL, 4, 2, 4, NULL, 120, 0, 100, NULL, 34.00, 213, 'REF-2020', '{\"1771938225577\":{\"name\":\"CLOTH NS\",\"qty\":\"1\"}}', '2026-02-24 13:03:50', 1, 0, NULL),
(3, 'LOWER-901/28', '901/28', 'Finished Goods', NULL, 1, 2, 1, 'mix', 12, 12, 123, 123.00, 234.00, 201, 'REG', '', '2026-02-24 13:21:55', NULL, 0, NULL),
(4, 'LOWER-901/24', '901/24', 'Finished Goods', NULL, 1, 3, 3, NULL, 100, 10, 50, 120.00, 250.00, 312, 'OPENING-2026', '[{\"name\":\"CLOTH NS\",\"qty\":1,\"id\":0}]', '2026-02-24 13:33:37', 1, 0, NULL),
(5, 'LOWER (NYLON TERRY) 7001-G', '7001-G', 'Finished Goods', NULL, 1, 3, 1, NULL, 12, 12, 212, 213.00, 567.00, 1000, 'REF-270222026', '[{\"name\":\"CLOTH 2 THREAD (SPUN)\",\"qty\":1,\"id\":0}]', '2026-02-24 13:41:40', 1, 0, NULL),
(6, 'testing 2', 'TEE01', 'Raw Material', 1, 1, 1, 1, NULL, 120, 10, 200, 4500.00, 5400.00, 2002, 'REF-02270303', '[]', '2026-02-26 12:03:20', 2, 300, NULL),
(7, 'Cargo ', 'CAR01', 'Finished Goods', 2, 1, 1, 1, NULL, 10, 10, 980, 250.00, 450.00, 1000, 'FG-OPEN-2026', '[{\"name\":\"button\",\"qty\":1,\"id\":0}]', '2026-02-28 02:31:31', 4, 978, NULL),
(8, 'Red cotton Fabric', 'RM-0001', 'Raw Material', 1, 1, NULL, NULL, NULL, 100, 10, 10, 540.00, NULL, 100, 'OPEN -01', NULL, '2026-02-28 02:43:11', NULL, 0, NULL),
(9, 'Jeans', 'JNS01', 'Finished Goods', 2, 1, 2, 2, NULL, 100, 10, 100, 450.00, 700.00, 2001, 'FG-OPEN-2026', '[{\"name\":\"button\",\"qty\":1,\"id\":0}]', '2026-02-28 08:59:17', 1, 100, NULL),
(10, 'Black Tshirt', 'BK001', 'Finished Goods', 2, 6, 6, 1, NULL, 0, 0, 200, 345.00, 650.00, 351, 'FG-OPEN-2026', '[]', '2026-03-02 17:39:36', 5, 141, NULL),
(11, 'Plan tshirt', 'JH8798', 'Finished Goods', 2, 6, 6, 1, NULL, 0, 0, 10, 0.00, 0.00, 50, 'FG-OPEN-2026', '[]', '2026-03-02 18:11:40', 6, 5, NULL),
(13, 'test', 'RM-0003', 'Raw Material', 1, 1, NULL, NULL, NULL, 0, 0, 100, 0.00, NULL, 0, '', NULL, '2026-03-07 10:58:12', NULL, 0, NULL),
(15, 'Denim Jackets', 'DNMJ001', 'Finished Goods', 2, 7, 7, 2, NULL, 0, 0, 100, 225.00, 432.00, 205, '', '[{\"name\":\"Button\",\"qty\":10,\"id\":1},{\"name\":\"Durable Cotton Fabrics\",\"qty\":10,\"id\":2}]', '2026-03-09 12:13:40', 0, 0, NULL),
(16, 'Leg-jeans', 'SU932', 'Finished Goods', 2, 1, 3, 2, NULL, 0, 0, 50, 80.00, 140.00, 100, '', '[{\"name\":\"Button\",\"qty\":5,\"id\":1},{\"name\":\"Durable Cotton Fabrics\",\"qty\":5,\"id\":2}]', '2026-03-12 08:15:38', 0, 0, NULL),
(17, 'Leather Jacket', 'LJ39', 'Finished Goods', 2, 7, 7, 1, NULL, 0, 0, 100, 740.00, 1500.00, 200, '', '[{\"name\":\"Button\",\"qty\":10,\"id\":1}]', '2026-03-18 10:45:31', 0, 50, NULL),
(18, 'Half Shirt', 'HS01', 'Finished Goods', 2, 1, 1, 0, NULL, 0, 1, 100, 140.00, 300.00, 200, '', '[{\"name\":\"Button\",\"qty\":10,\"id\":1}]', '2026-03-18 11:18:04', 0, 200, NULL);

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

--
-- Table structure for table `product_recipe`
--

CREATE TABLE `product_recipe` (
  `id` int(11) NOT NULL,
  `product_id` int(11) DEFAULT NULL,
  `raw_material_id` int(11) DEFAULT NULL,
  `quantity_required` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `purchases`
--

CREATE TABLE `purchases` (
  `id` int(11) NOT NULL,
  `vendor_id` int(11) NOT NULL,
  `bill_no` varchar(100) DEFAULT NULL,
  `item_type` enum('finished','raw') NOT NULL,
  `discount_percent` float DEFAULT 0,
  `gst_percent` float DEFAULT 0,
  `total_payable` float NOT NULL,
  `created_at` datetime DEFAULT current_timestamp(),
  `purchase_type` varchar(50) DEFAULT 'General',
  `purchase_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `purchases`
--

INSERT INTO `purchases` (`id`, `vendor_id`, `bill_no`, `item_type`, `discount_percent`, `gst_percent`, `total_payable`, `created_at`, `purchase_type`, `purchase_date`) VALUES
(14, 1, NULL, 'raw', 0, 18, 1416, '2026-03-10 17:07:55', 'General', '2026-03-09 18:30:00'),
(15, 1, NULL, 'finished', 0, 18, 472, '2026-03-10 17:10:45', 'General', '2026-03-09 18:30:00'),
(16, 1, '', 'raw', 0, 18, 0, '2026-03-11 16:42:51', 'General', '2026-03-10 18:30:00'),
(17, 1, '', 'finished', 0, 18, 35.4, '2026-03-12 11:46:42', 'General', '2026-03-11 18:30:00'),
(18, 1, '', 'raw', 0, 18, 2360, '2026-03-12 13:48:09', 'General', '2026-03-11 18:30:00');

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

--
-- Table structure for table `purchase_items`
--

CREATE TABLE `purchase_items` (
  `id` int(11) NOT NULL,
  `purchase_id` int(11) DEFAULT NULL,
  `product_id` int(11) DEFAULT NULL,
  `qty` decimal(10,2) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `batch_no` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `purchase_items`
--

INSERT INTO `purchase_items` (`id`, `purchase_id`, `product_id`, `qty`, `rate`, `batch_no`) VALUES
(15, 14, 2, 120.00, 10.00, NULL),
(16, 15, 15, 1.00, 400.00, NULL),
(17, 16, 1, 10.00, 0.00, ''),
(18, 17, 15, 3.00, 10.00, ''),
(19, 18, 1, 100.00, 10.00, ''),
(20, 18, 2, 100.00, 10.00, '');

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

--
-- Table structure for table `raw_materials`
--

CREATE TABLE `raw_materials` (
  `id` int(11) NOT NULL,
  `material_id` varchar(50) NOT NULL,
  `material_name` varchar(255) NOT NULL,
  `material_image` varchar(255) DEFAULT NULL,
  `uom_id` int(11) DEFAULT NULL,
  `avg_daily_consumption` decimal(10,2) DEFAULT 0.00,
  `lead_time` int(11) DEFAULT 0,
  `safety_stock` decimal(10,2) DEFAULT 0.00,
  `opening_stock` decimal(10,2) DEFAULT 0.00,
  `batch_no` varchar(100) DEFAULT NULL,
  `cost_per_unit` decimal(10,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `raw_materials`
--

INSERT INTO `raw_materials` (`id`, `material_id`, `material_name`, `material_image`, `uom_id`, `avg_daily_consumption`, `lead_time`, `safety_stock`, `opening_stock`, `batch_no`, `cost_per_unit`, `created_at`) VALUES
(1, 'RM-0001', 'Button', 'uploads/raw/RM_1773309674.jpg', 2, 0.00, 0, 200.00, 0.00, '', 10.00, '2026-03-09 11:23:04'),
(2, '', 'Durable Cotton Fabrics', 'uploads/raw/RM_1773309989.png', 2, 0.00, 0, 0.00, 0.00, 'RM-QUICK-2026', 0.00, '2026-03-09 11:27:11'),
(3, 'RM-0003', 'Latkan', 'uploads/raw/RM_1773224833.png', 2, 0.00, 0, 0.00, 1000.00, '', 10.00, '2026-03-11 10:27:13');

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

--
-- Table structure for table `sales_orders`
--

CREATE TABLE `sales_orders` (
  `id` int(11) NOT NULL,
  `order_id` varchar(20) NOT NULL,
  `product_id` int(11) NOT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `contact_number` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `gst_number` varchar(50) DEFAULT NULL,
  `prev_live_stock` int(11) DEFAULT 0,
  `prev_safety_stock` int(11) DEFAULT 0,
  `total_ordered_qty` int(11) NOT NULL,
  `dispatch_qty` int(11) DEFAULT 0,
  `production_qty` int(11) DEFAULT 0,
  `status` enum('Pending','Processing','Completed') DEFAULT 'Pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sales_orders`
--

INSERT INTO `sales_orders` (`id`, `order_id`, `product_id`, `customer_name`, `contact_number`, `address`, `gst_number`, `prev_live_stock`, `prev_safety_stock`, `total_ordered_qty`, `dispatch_qty`, `production_qty`, `status`, `created_at`) VALUES
(1, 'STO-68424', 6, NULL, NULL, NULL, NULL, 0, 0, 100, 100, 800, 'Pending', '2026-03-02 16:51:38'),
(2, 'STO-67106', 8, NULL, NULL, NULL, NULL, 0, 0, 10, 10, 0, 'Pending', '2026-03-02 17:02:26'),
(4, 'STO-65864', 10, 'Dipanshu Kumar Singh', '06201403690', 'Beldiha , Banka , Bihar', NULL, 250, 200, 300, 0, 500, 'Pending', '2026-03-02 17:52:53'),
(5, 'STO-23894', 10, 'Dipanshu Kumar Singh', '06201403690', 'Beldiha , Banka , Bihar', NULL, 250, 200, 300, 0, 500, 'Pending', '2026-03-02 18:05:00'),
(6, 'STO-24263', 10, NULL, NULL, NULL, NULL, 0, 0, 300, 0, 0, 'Pending', '2026-03-02 18:08:40'),
(7, 'STO-26007', 11, NULL, NULL, NULL, NULL, 0, 0, 45, 45, 5, 'Pending', '2026-03-02 18:12:05'),
(8, 'STO-44109', 15, 'Raj Mohan ', '9876543210', 'Dhanbad , Jharkhand , India', 'DFGHJ456789', 0, 0, 50, 50, 0, 'Pending', '2026-03-09 12:40:19'),
(10, 'STO-32455', 15, 'SystAIO Technologies', '9308788991', 'D', 'DFGHJK56789', 150, 100, 200, 150, 0, '', '2026-03-10 07:22:54'),
(11, 'STO-92038', 10, 'Manisha', '9874563210', 'Dhanbad , Jharkhand', 'fghj789nfga', 240, 200, 100, 100, 60, '', '2026-03-10 08:04:21'),
(12, 'STO-92038', 6, 'Manisha', '9874563210', 'Dhanbad , Jharkhand', 'fghj789nfga', 400, 200, 100, 100, 0, '', '2026-03-10 08:04:21'),
(13, 'STO-13296', 10, 'Dipanshu', '6201403690', 'Dhanbad', '', 241, 200, 100, 100, 59, '', '2026-03-12 08:12:16'),
(14, 'STO-68215', 16, 'Dipanshu Kumar Singh', '06201403690', 'Beldiha , Banka , Bihar', '', 100, 50, 100, 100, 0, '', '2026-03-12 08:16:40'),
(15, 'STO-49584', 16, 'rahul singh', '06201403690', 'Beldiha , Banka , Bihar', '', 0, 50, 10, 0, 0, '', '2026-03-12 08:20:01'),
(16, 'STO-10529', 15, 'Manisha ', '9999999999', 'Dhaanbad', '', 5, 100, 100, 5, 0, '', '2026-03-12 08:25:39'),
(17, 'STO-10529', 8, 'Manisha ', '9999999999', 'Dhaanbad', '', 85, 10, 100, 85, 0, '', '2026-03-12 08:25:40'),
(18, 'STO-54703', 15, 'Testing string', '7474747474', 'India', '', 0, 100, 100, 0, 0, '', '2026-03-12 08:26:52'),
(19, 'STO-12126', 15, 'Testing string2', '', '', '', 0, 100, 100, 0, 0, '', '2026-03-12 08:28:17'),
(20, 'STO-79994', 15, 'Mohan', '8787878787', '', '', 0, 100, 100, 0, 0, '', '2026-03-12 08:40:36'),
(21, 'STO-37011', 15, 'Arpana', '', '', '', 0, 100, 100, 0, 30, '', '2026-03-12 08:44:59'),
(22, 'STO-90229', 17, 'Dipanshu Kumar Singh', '06201403690', 'Beldiha , Banka , Bihar', '', 200, 100, 150, 150, 50, '', '2026-03-18 10:47:30');

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

--
-- Table structure for table `sampling`
--

CREATE TABLE `sampling` (
  `id` int(11) NOT NULL,
  `sample_id` varchar(20) NOT NULL,
  `customer_name` varchar(255) NOT NULL,
  `contact_number` varchar(20) DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `category_id` int(11) DEFAULT NULL,
  `fabric_id` int(11) DEFAULT NULL,
  `color_details` varchar(255) DEFAULT NULL,
  `selected_sizes` varchar(255) DEFAULT NULL,
  `product_details` text DEFAULT NULL,
  `message` text DEFAULT NULL,
  `sample_images_json` text DEFAULT NULL,
  `status` enum('Pending','In-Development','Sent-to-Client','Approved','Rejected') DEFAULT 'Pending',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sampling`
--

INSERT INTO `sampling` (`id`, `sample_id`, `customer_name`, `contact_number`, `product_name`, `category_id`, `fabric_id`, `color_details`, `selected_sizes`, `product_details`, `message`, `sample_images_json`, `status`, `created_at`) VALUES
(1, 'SAM-51447', 'Dipanshu Kumar Singh', '06201403690', 'half shirt', NULL, NULL, '', 'L', '', '', NULL, 'Pending', '2026-03-02 18:37:23'),
(2, 'SAM-17942', 'Arpana', '06201403690', 'test', 1, 1, '', 'M, L', '', 'gsm,fsm', '[\"SAM_IMG_1773313853_images (1).jpg\",\"SAM_IMG_1773313853_CottonKing.04.01.20242096.jpg\"]', 'Pending', '2026-03-12 11:10:53');

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

--
-- Table structure for table `sub_categories`
--

CREATE TABLE `sub_categories` (
  `id` int(11) NOT NULL,
  `category_id` int(11) DEFAULT NULL,
  `sub_category_name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `sub_categories`
--

INSERT INTO `sub_categories` (`id`, `category_id`, `sub_category_name`) VALUES
(1, 1, 'gents lower'),
(2, 1, 'test'),
(3, 1, 'ladies lower'),
(4, 1, 'all '),
(5, 5, 'gent\'s Capri'),
(6, 6, 'mens wear'),
(7, 7, 'woolen');

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

--
-- Table structure for table `units`
--

CREATE TABLE `units` (
  `id` int(11) NOT NULL,
  `unit_name` varchar(50) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `units`
--

INSERT INTO `units` (`id`, `unit_name`, `created_at`) VALUES
(1, 'ROLL', '2026-02-26 11:49:55'),
(2, 'PCS', '2026-02-26 11:49:55'),
(3, 'MTR', '2026-02-26 11:49:55'),
(4, 'KG', '2026-02-26 11:49:55');

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

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

CREATE TABLE `vendors` (
  `id` int(11) NOT NULL,
  `vendor_name` varchar(255) NOT NULL,
  `category` varchar(100) DEFAULT 'Material Supplier',
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `gst_number` varchar(50) DEFAULT NULL,
  `status` enum('Active','Inactive') DEFAULT 'Active',
  `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_name`, `category`, `phone`, `email`, `address`, `gst_number`, `status`, `created_at`) VALUES
(1, 'Test', 'Material Supplier', '9876543210', 'test@gmail.com', 'test', 'DFGH45678FGHJ', 'Active', '2026-03-07 07:46:45');

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

--
-- Table structure for table `vendor_procurement`
--

CREATE TABLE `vendor_procurement` (
  `id` int(11) NOT NULL,
  `order_code` varchar(50) DEFAULT NULL,
  `product_name` varchar(255) DEFAULT NULL,
  `vendor_id` int(11) DEFAULT NULL,
  `sent_qty` int(11) DEFAULT NULL,
  `status` varchar(50) DEFAULT 'Ordered',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `raw_materials_json` longtext DEFAULT NULL,
  `kitting_proofs_json` text DEFAULT NULL,
  `production_status` varchar(100) DEFAULT 'Cutting'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `vendor_procurement`
--

INSERT INTO `vendor_procurement` (`id`, `order_code`, `product_name`, `vendor_id`, `sent_qty`, `status`, `created_at`, `raw_materials_json`, `kitting_proofs_json`, `production_status`) VALUES
(1, 'STO-24263', 'Black Tshirt', 1, 500, 'Ordered', '2026-03-07 08:22:28', NULL, NULL, 'Packing'),
(2, 'STO-37011', 'Denim Jackets', 1, 10, 'Ordered', '2026-03-12 08:56:37', '[{\"id\":1,\"name\":\"Button\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100}]', NULL, 'Cutting'),
(3, 'STO-37011', 'Denim Jackets', 1, 10, 'Ordered', '2026-03-12 10:41:53', '[{\"id\":1,\"name\":\"Button\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100},{\"id\":2,\"name\":\"Durable Cotton Fabrics\",\"needed\":100,\"sent\":\"0.00\",\"pending\":100}]', '[\"KIT_1773312113_istockphoto-1352728757-612x612.jpg\",\"KIT_1773312113_images.jpg\"]', 'Stitching');

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Indexes for table `purchase_items`
--
ALTER TABLE `purchase_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_id` (`purchase_id`);

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `product_recipe`
--
ALTER TABLE `product_recipe`
  ADD CONSTRAINT `product_recipe_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `product_master` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `purchase_items`
--
ALTER TABLE `purchase_items`
  ADD CONSTRAINT `purchase_items_ibfk_1` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`);

--
-- Constraints for table `sub_categories`
--
ALTER TABLE `sub_categories`
  ADD CONSTRAINT `sub_categories_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`);
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 */;
