-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Mar 02, 2026 at 01:48 PM
-- Server version: 10.4.27-MariaDB
-- PHP Version: 7.4.33

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

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

--
-- Table structure for table `admin_users`
--

CREATE TABLE `admin_users` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

--
-- Dumping data for table `admin_users`
--

INSERT INTO `admin_users` (`id`, `username`, `password`, `created_at`) VALUES
(1, 'admin', '81dc9bdb52d04dc20036dbd8313ed055', '2025-10-14 07:24:34');

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

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

CREATE TABLE `invoices` (
  `id` int(11) NOT NULL,
  `invoice_no` varchar(50) DEFAULT NULL,
  `invoice_date` datetime DEFAULT NULL,
  `company_name` varchar(100) DEFAULT NULL,
  `client_name` varchar(100) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `subtotal` decimal(10,2) DEFAULT NULL,
  `discount_type` varchar(10) DEFAULT NULL,
  `discount_value` decimal(10,2) DEFAULT 0.00,
  `cgst` decimal(10,2) DEFAULT NULL,
  `sgst` decimal(10,2) DEFAULT NULL,
  `final_amount` decimal(10,2) DEFAULT NULL,
  `paid_amount` decimal(10,2) DEFAULT 0.00,
  `dues_amount` decimal(10,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `pan_no` varchar(20) DEFAULT NULL,
  `gst_no` varchar(20) DEFAULT NULL,
  `state` varchar(50) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `pincode` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `invoices` (`id`, `invoice_no`, `invoice_date`, `company_name`, `client_name`, `phone`, `address`, `subtotal`, `discount_type`, `discount_value`, `cgst`, `sgst`, `final_amount`, `paid_amount`, `dues_amount`, `created_at`, `pan_no`, `gst_no`, `state`, `city`, `pincode`) VALUES
(108, 'RP/25/26/01', '2026-03-02 00:00:00', 'R.P. JEWELLERS & SONS', 'pranab', '08617886268', 'baribhasa', '28171.00', 'value', '200.00', '422.57', '422.57', '29016.14', '31511.82', '0.00', '2026-03-02 09:42:19', '', '', 'west bangal', 'siliguri', '735135'),
(109, 'RP/25/26/02', '2026-03-02 00:00:00', 'R.P. JEWELLERS & SONS', 'pranab', '08617886268', 'baribhasa', '29101.50', 'value', '858.00', '0.00', '0.00', '29974.55', '0.00', '29974.55', '2026-03-02 09:43:32', '', '', 'Goa', 'siliguri', '735135'),
(110, 'RP/25/26/03', '2026-03-02 00:00:00', 'R.P. JEWELLERS & SONS', 'pranab sahani', '08617886268', 'baribhasa', '1749511.33', 'value', '5665.00', '26242.67', '26242.67', '1801996.67', '1798620.35', '3376.32', '2026-03-02 11:09:53', 'AAFCC8093F', '45', 'west bangal', 'siliguri', '735135');

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

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

CREATE TABLE `invoice_items` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL,
  `hsn` varchar(20) DEFAULT NULL,
  `gross_weight` decimal(10,3) DEFAULT NULL,
  `net_weight` decimal(10,3) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `making` decimal(10,2) DEFAULT NULL,
  `stone_value` decimal(10,2) DEFAULT NULL,
  `total` decimal(10,2) DEFAULT NULL,
  `hm_type` varchar(10) DEFAULT 'percent',
  `hm_value` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `invoice_items` (`id`, `invoice_id`, `description`, `hsn`, `gross_weight`, `net_weight`, `rate`, `making`, `stone_value`, `total`, `hm_type`, `hm_value`) VALUES
(441, 108, '22 k HM Gold G.Ring one pic (91.6)', '7113', '2.220', '2.220', '12250.00', '1111.00', '0.00', '28351.00', 'value', '45.00'),
(446, 109, '22 k HM Gold G.Ring one pic (91.6)', '7113', '2.220', '2.220', '12250.00', '2719.50', '0.00', '29959.50', 'value', '45.00'),
(447, 110, '22 k HM Gold G.Ring one pic (91.6)', '7113', '2.220', '2.220', '12250.00', '961071.30', '0.00', '988311.30', 'percent', '45.00'),
(448, 110, '22 k HM Gold G.Ring one pic (91.6)', '7113', '2.220', '2.220', '12250.00', '739568.03', '0.00', '766808.03', 'percent', '45.00');

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

--
-- Table structure for table `invoice_other_charges`
--

CREATE TABLE `invoice_other_charges` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `charge_name` varchar(100) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `invoice_other_charges`
--

INSERT INTO `invoice_other_charges` (`id`, `invoice_id`, `charge_name`, `amount`, `created_at`) VALUES
(63, 0, 'ds', '20.00', '2026-03-02 09:42:19'),
(67, 108, 'ds', '20.00', '2026-03-02 09:43:07'),
(68, 0, 'fdgdf', '56.00', '2026-03-02 11:09:53'),
(69, 0, 'sdfgdf', '57.00', '2026-03-02 11:09:53'),
(70, 110, 'sdfgdf', '57.00', '2026-03-02 11:09:53');

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

--
-- Table structure for table `invoice_payments`
--

CREATE TABLE `invoice_payments` (
  `id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `payment_type` varchar(50) NOT NULL COMMENT 'UPI / Bank / Metal / Cash',
  `amount` decimal(12,2) NOT NULL 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 `invoice_payments`
--

INSERT INTO `invoice_payments` (`id`, `invoice_id`, `payment_type`, `amount`, `note`, `created_at`) VALUES
(146, 108, 'UPI', '200.00', NULL, '2026-03-02 09:43:07'),
(147, 108, 'Cheque', '2000.00', NULL, '2026-03-02 09:43:07'),
(148, 108, 'Metal', '4000.00', NULL, '2026-03-02 09:43:07'),
(149, 108, 'Cash', '25311.82', NULL, '2026-03-02 09:43:07'),
(150, 110, 'UPI', '45345.00', NULL, '2026-03-02 11:09:53'),
(151, 110, 'Cheque', '345345.00', NULL, '2026-03-02 11:09:53'),
(152, 110, 'Metal', '4345.00', NULL, '2026-03-02 11:09:53'),
(153, 110, 'Cash', '43345.00', NULL, '2026-03-02 11:09:53'),
(154, 110, 'Card', '1360240.35', NULL, '2026-03-02 11:09:53');

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

--
-- Table structure for table `jewellery_stock`
--

CREATE TABLE `jewellery_stock` (
  `id` int(11) NOT NULL,
  `invoice_no` varchar(50) DEFAULT NULL,
  `item_name` varchar(255) NOT NULL,
  `category` varchar(100) NOT NULL,
  `gross_weight` decimal(10,3) NOT NULL,
  `net_weight` decimal(10,3) NOT NULL,
  `rate` decimal(10,2) NOT NULL,
  `making_type` enum('percent','fixed') DEFAULT 'percent',
  `making_value` decimal(10,2) DEFAULT 0.00,
  `stone_value` decimal(10,2) DEFAULT 0.00,
  `hm_value` decimal(10,2) DEFAULT 0.00,
  `total_value` decimal(10,2) DEFAULT 0.00,
  `purchased_from` varchar(255) DEFAULT '',
  `supplier_phone` varchar(20) DEFAULT '',
  `supplier_pan` varchar(50) DEFAULT NULL,
  `supplier_gst` varchar(50) DEFAULT NULL,
  `supplier_address` text DEFAULT NULL,
  `supplier_state` varchar(100) DEFAULT NULL,
  `supplier_city` varchar(100) DEFAULT NULL,
  `supplier_pincode` varchar(20) DEFAULT NULL,
  `supplier_whatsapp` varchar(20) DEFAULT '',
  `supplier_email` varchar(255) DEFAULT '',
  `sold_to` varchar(255) DEFAULT '',
  `customer_phone` varchar(20) DEFAULT '',
  `customer_whatsapp` varchar(20) DEFAULT '',
  `customer_email` varchar(255) DEFAULT '',
  `added_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `pay_upi` decimal(10,2) DEFAULT 0.00,
  `pay_cheque` decimal(10,2) DEFAULT 0.00,
  `pay_metal` decimal(10,2) DEFAULT 0.00,
  `pay_cash` decimal(10,2) DEFAULT 0.00,
  `pay_card` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

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

CREATE TABLE `products` (
  `id` int(11) NOT NULL,
  `product_name` varchar(200) DEFAULT NULL,
  `hsn` varchar(50) DEFAULT NULL,
  `weight` varchar(50) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `products` (`id`, `product_name`, `hsn`, `weight`, `created_at`) VALUES
(7, 'sadds dsd', 'sdsdds', '30.88', '2026-03-02 05:17:33');

--
-- Indexes for dumped tables
--

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

--
-- 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 `invoice_other_charges`
--
ALTER TABLE `invoice_other_charges`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `invoice_payments`
--
ALTER TABLE `invoice_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_id_idx` (`invoice_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `invoice_payments`
--
ALTER TABLE `invoice_payments`
  ADD CONSTRAINT `fk_invoice` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
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 */;
