-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 12, 2025 at 12:35 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: `stock`
--

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

--
-- Table structure for table `fault_stock`
--

CREATE TABLE `fault_stock` (
  `id` int(11) NOT NULL,
  `company_name` varchar(255) NOT NULL,
  `fault_date` date NOT NULL,
  `given_to` varchar(100) NOT NULL,
  `item_name` varchar(100) NOT NULL,
  `qty` int(11) NOT NULL,
  `remarks` text DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `particular_name` varchar(255) DEFAULT NULL,
  `specification` varchar(255) DEFAULT NULL,
  `model_number` varchar(255) DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `purchase_stock_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `outward_stock`
--

CREATE TABLE `outward_stock` (
  `id` int(11) NOT NULL,
  `outward_date` date DEFAULT NULL,
  `given_to` varchar(150) DEFAULT NULL,
  `item_name` varchar(100) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `remarks` varchar(200) DEFAULT NULL,
  `particular_name` varchar(255) DEFAULT NULL,
  `specification` varchar(255) DEFAULT NULL,
  `model_number` varchar(255) DEFAULT NULL,
  `os_number` varchar(8) NOT NULL,
  `purchase_stock_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `purchase_invoice`
--

CREATE TABLE `purchase_invoice` (
  `id` int(11) NOT NULL,
  `company_name` varchar(255) NOT NULL,
  `invoice_number` varchar(50) DEFAULT NULL,
  `incoming_date` date DEFAULT NULL,
  `courier_name` varchar(100) DEFAULT NULL,
  `courier_charge` decimal(10,2) DEFAULT NULL,
  `total_amount` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Table structure for table `purchase_stock`
--

CREATE TABLE `purchase_stock` (
  `id` int(11) NOT NULL,
  `company_name` varchar(255) NOT NULL,
  `invoice_number` varchar(50) DEFAULT NULL,
  `incoming_date` date DEFAULT NULL,
  `courier_name` varchar(100) DEFAULT NULL,
  `item_name` varchar(100) DEFAULT NULL,
  `particular_name` varchar(100) DEFAULT NULL,
  `specification` varchar(100) DEFAULT NULL,
  `model_number` varchar(50) DEFAULT NULL,
  `qty` decimal(10,2) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `gst` decimal(10,2) DEFAULT NULL,
  `total` decimal(10,2) DEFAULT NULL,
  `fault_count` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `users` (
  `user_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 `users`
--

INSERT INTO `users` (`user_id`, `username`, `password`) VALUES
(1, 'admin', '$2y$10$RncU0NMy0Cflh6q60vENbOThZ8EYq75L0nrOocXc1vEOA8EIl.ua6'),
(3, 'malvino', '$2y$10$6qniyvn3IHZbvRd6nMxqTeSwkWEkEAbA7lMruF.fM6YEEZ4mkYok2'),
(4, 'veera', '$2y$10$UKoZia8KyCKxawdCB7VkKud6xQ7hdw4vR9CAC5YIQ4wI5kFxEVAD.'),
(5, 'riyas', '$2y$10$fmIg0/AQCEK.o2bL.Szxcu2HmtkuMQYuK63P2vJzFgLCinkSRV1/2'),
(6, 'pavithra', '$2y$10$fmktb9C2pLgXNtXJtsbGS.BCAYQWvU0UVK5w9kvfD7ZHAwmQiztf2'),
(7, 'logan', '$2y$10$AoFGN7f.nw7sKNS/FrIzNeYPspIoInk7izEImhTeFCjXPIxXmt1ie');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `fault_stock`
--
ALTER TABLE `fault_stock`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_fault_purchase` (`purchase_stock_id`);

--
-- Indexes for table `outward_stock`
--
ALTER TABLE `outward_stock`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `os_number` (`os_number`),
  ADD KEY `fk_outward_purchase` (`purchase_stock_id`);

--
-- Indexes for table `purchase_invoice`
--
ALTER TABLE `purchase_invoice`
  ADD PRIMARY KEY (`id`);
ALTER TABLE `purchase_invoice` ADD FULLTEXT KEY `invoice_number` (`invoice_number`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `fault_stock`
--
ALTER TABLE `fault_stock`
  ADD CONSTRAINT `fk_fault_purchase` FOREIGN KEY (`purchase_stock_id`) REFERENCES `purchase_stock` (`id`);

--
-- Constraints for table `outward_stock`
--
ALTER TABLE `outward_stock`
  ADD CONSTRAINT `fk_outward_purchase` FOREIGN KEY (`purchase_stock_id`) REFERENCES `purchase_stock` (`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 */;
