-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 03, 2026 at 06:59 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.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: `grocery`
--

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

--
-- Table structure for table `accounts`
--

CREATE TABLE `accounts` (
  `id` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `name` varchar(200) NOT NULL,
  `print_as` varchar(200) DEFAULT NULL,
  `group_name` varchar(100) NOT NULL,
  `opening_balance` decimal(12,2) DEFAULT 0.00,
  `drcr` enum('Dr','Cr') DEFAULT 'Dr',
  `address1` varchar(255) DEFAULT NULL,
  `address2` varchar(255) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `pincode` varchar(20) DEFAULT NULL,
  `state` varchar(100) DEFAULT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `email` varchar(150) DEFAULT NULL,
  `contact_person` varchar(150) DEFAULT NULL,
  `pan` varchar(20) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `accounts`
--

INSERT INTO `accounts` (`id`, `business_id`, `name`, `print_as`, `group_name`, `opening_balance`, `drcr`, `address1`, `address2`, `city`, `pincode`, `state`, `mobile`, `phone`, `email`, `contact_person`, `pan`, `created_at`) VALUES
(1, 0, 'Shivam Enterprise', '20', 'SUPPLIERS', 1000.00, 'Cr', 'Home Cafe', 'Siliguri Institute Of Technology,sukna', 'SILIGURI', '734009', 'West Bengal', '8617608671', '', '', 'Shivam Das', '', '2025-12-29 15:12:45'),
(2, 0, 'Shivam Enterprise', '20', 'SUPPLIERS', 1000.00, 'Cr', 'Home Cafe', 'Siliguri Institute Of Technology,sukna', 'SILIGURI', '734009', 'West Bengal', '8617608671', '', '', 'Shivam Das', '', '2025-12-29 15:13:12'),
(3, 0, 'Shivam Enterprise', '20', 'SUPPLIERS', 1000.00, 'Cr', 'Home Cafe', 'Siliguri Institute Of Technology,sukna', 'SILIGURI', '734009', 'West Bengal', '8617608671', '', '', 'Shivam Das', '', '2025-12-29 15:14:04'),
(4, 0, 'shivam', 'shivam', 'CUSTOMERS', 0.00, 'Dr', '', '', '', '', 'West Bengal', '8617608671', '', '', '', '', '2026-01-01 18:21:55'),
(5, 0, 'Shivam Das', '', 'CUSTOMERS', 0.00, 'Dr', 'Sepco', '', 'Durgapur', '722202', 'West Bengal', '08348872742', '', '', '', '', '2026-01-02 17:03:48');

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

--
-- Table structure for table `new_items`
--

CREATE TABLE `new_items` (
  `id` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `item_name` varchar(255) DEFAULT NULL,
  `short_name` varchar(100) DEFAULT NULL,
  `hsn_code` varchar(50) DEFAULT NULL,
  `tax_slab` varchar(20) DEFAULT NULL,
  `company` varchar(100) DEFAULT NULL,
  `item_group` varchar(100) DEFAULT NULL,
  `primary_unit` varchar(50) DEFAULT NULL,
  `alternate_unit` varchar(50) DEFAULT NULL,
  `conversion_factor` int(11) DEFAULT NULL,
  `price_per` varchar(50) DEFAULT NULL,
  `purchase_price` decimal(10,2) DEFAULT NULL,
  `sale_price` decimal(10,2) DEFAULT NULL,
  `mrp` decimal(10,2) DEFAULT NULL,
  `opening_qty_kg` decimal(10,2) DEFAULT NULL,
  `opening_qty_gm` decimal(10,2) DEFAULT NULL,
  `img` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `new_items`
--

INSERT INTO `new_items` (`id`, `business_id`, `item_name`, `short_name`, `hsn_code`, `tax_slab`, `company`, `item_group`, `primary_unit`, `alternate_unit`, `conversion_factor`, `price_per`, `purchase_price`, `sale_price`, `mrp`, `opening_qty_kg`, `opening_qty_gm`, `img`, `created_at`) VALUES
(1, 11, 'sugar', '', '', '5', '', '', 'gm', 'kg', 1000, 'kg', 55.00, 40.00, 47.00, 40.00, 500.00, '', '2025-12-29 14:24:25'),
(2, 11, 'rice', '', '123', '5', '123', '123', 'gm', 'kg', 1000, 'kg', 44.00, 41.00, 50.00, 7.00, 500.00, '', '2025-12-29 14:44:13'),
(3, 11, 'eggs', '', '', '5', '', '', 'Pcs', 'Pcs', 1, 'Pcs', 10.00, 15.00, 15.00, 100.00, 0.00, '', '2026-01-01 17:44:04'),
(4, 11, 'dal', '', '', '5', '', 'Grocery', 'kg', 'kg', 1000, 'kg', 35.00, 25.00, 25.00, 17.00, NULL, '', '2026-01-01 18:01:06'),
(5, 11, 'kinder joy', '', '', '0', '', 'Grocery', 'Pcs', 'Pcs', 1, 'Pcs', 40.00, 35.00, 42.00, 20.00, NULL, '', '2026-01-02 17:53:31');

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

--
-- Table structure for table `payment_requests`
--

CREATE TABLE `payment_requests` (
  `id` int(11) NOT NULL,
  `restaurant_id` int(11) NOT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `mode` varchar(50) DEFAULT NULL,
  `transaction_id` varchar(100) DEFAULT NULL,
  `screenshot` varchar(255) DEFAULT NULL,
  `status` enum('pending','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 `payment_requests`
--

INSERT INTO `payment_requests` (`id`, `restaurant_id`, `amount`, `mode`, `transaction_id`, `screenshot`, `status`, `created_at`) VALUES
(1, 11, 400.00, 'Bank Transfer', 'dvxvcx', '', 'approved', '2025-12-20 13:18:51'),
(2, 12, 400.00, 'Bank Transfer', 'ds', '', 'approved', '2026-01-02 17:27:01'),
(3, 12, 400.00, 'Bank Transfer', 'ds', '', 'pending', '2026-01-02 17:27:33');

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

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

CREATE TABLE `sales` (
  `id` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `bill_no` varchar(50) DEFAULT NULL,
  `sale_date` date DEFAULT NULL,
  `party_id` int(11) DEFAULT NULL,
  `subtotal` decimal(10,2) DEFAULT NULL,
  `cgst` decimal(10,2) DEFAULT NULL,
  `sgst` decimal(10,2) DEFAULT NULL,
  `grand_total` decimal(10,2) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `payment_terms` varchar(50) DEFAULT NULL,
  `total_discount` decimal(10,2) DEFAULT 0.00,
  `total_tax` decimal(10,2) DEFAULT 0.00,
  `cash_tendered` decimal(10,2) DEFAULT 0.00,
  `change_amount` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `sales` (`id`, `business_id`, `bill_no`, `sale_date`, `party_id`, `subtotal`, `cgst`, `sgst`, `grand_total`, `created_at`, `due_date`, `payment_terms`, `total_discount`, `total_tax`, `cash_tendered`, `change_amount`) VALUES
(1, 0, NULL, NULL, 2, 81.00, 7.29, 7.29, 95.58, '2025-12-30 20:46:50', NULL, NULL, 0.00, 0.00, 0.00, 0.00),
(2, 0, NULL, NULL, 1, 41.00, 3.69, 3.69, 48.38, '2025-12-30 20:48:52', NULL, NULL, 0.00, 0.00, 0.00, 0.00),
(3, 0, NULL, NULL, 1, 41.00, 3.69, 3.69, 48.38, '2025-12-30 20:51:30', NULL, NULL, 0.00, 0.00, 0.00, 0.00),
(4, 0, NULL, NULL, 1, 281.00, 25.29, 25.29, 331.58, '2025-12-30 20:53:38', NULL, NULL, 0.00, 0.00, 0.00, 0.00),
(5, 0, '', '2026-01-01', 1, 95.00, 0.00, 0.00, 95.00, '2026-01-01 23:24:24', '2026-01-01', 'Credit', 0.00, 0.00, 0.00, -80.00),
(6, 0, '', '2026-01-01', 1, 22.00, 0.00, 0.00, 22.00, '2026-01-02 00:11:42', '2026-01-01', 'Cash', 0.00, 0.00, 22.00, 0.00),
(7, 0, '', '2026-01-02', 5, 62.50, 0.00, 0.00, 62.50, '2026-01-02 22:37:30', '2026-01-02', 'Cash', 0.00, 0.00, 63.00, 0.50);

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

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

CREATE TABLE `sale_items` (
  `id` int(11) NOT NULL,
  `business_id` int(11) NOT NULL,
  `sale_id` int(11) DEFAULT NULL,
  `item_id` int(11) DEFAULT NULL,
  `batch_no` varchar(50) DEFAULT NULL,
  `qty` decimal(10,2) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `alt_qty` decimal(10,2) DEFAULT 0.00,
  `free_qty` decimal(10,2) DEFAULT 0.00,
  `discount_per` decimal(10,2) DEFAULT 0.00,
  `discount_amt` decimal(10,2) DEFAULT 0.00,
  `tax_per` decimal(10,2) DEFAULT 0.00,
  `tax_amt` decimal(10,2) DEFAULT 0.00,
  `net_value` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

INSERT INTO `sale_items` (`id`, `business_id`, `sale_id`, `item_id`, `batch_no`, `qty`, `rate`, `amount`, `alt_qty`, `free_qty`, `discount_per`, `discount_amt`, `tax_per`, `tax_amt`, `net_value`) VALUES
(1, 0, 1, 2, NULL, 1.00, 41.00, 41.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(2, 0, 2, 2, NULL, 1.00, 41.00, 41.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(3, 0, 3, 2, NULL, 1.00, 41.00, 41.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(4, 0, 4, 2, NULL, 1.00, 41.00, 41.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(5, 0, 4, 1, NULL, 6.00, 40.00, 240.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00),
(6, 0, 5, 3, '', 1.00, 15.00, 15.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 15.00),
(7, 0, 5, 1, '', 2.00, 40.00, 80.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 80.00),
(8, 0, 6, 4, '', 1.00, 22.00, 22.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 22.00),
(9, 0, 7, 4, '', 2.50, 25.00, 62.50, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 62.50);

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

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

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `business_name` varchar(120) NOT NULL DEFAULT 'My Restaurant',
  `address` varchar(255) NOT NULL DEFAULT '123, Main Road, Your City',
  `phone` varchar(30) NOT NULL DEFAULT '+91-90000 00000',
  `gstin` varchar(30) NOT NULL DEFAULT '',
  `gst_rate` decimal(5,2) NOT NULL DEFAULT 5.00,
  `gst_applicable` tinyint(1) NOT NULL DEFAULT 1,
  `password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

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

INSERT INTO `settings` (`id`, `business_name`, `address`, `phone`, `gstin`, `gst_rate`, `gst_applicable`, `password`) VALUES
(9, 'My Restaurant', '123, Main Road, Your City', '+91-90000 00000', '', 5.00, 1, ''),
(10, 'Guras kitchen', 'Sepco', '9874563211', '', 5.00, 0, '$2y$10$F8iyvqfH2jMeWUqTJ934AuTXjZUo8Pt44apGNHlx71y2TjHC9OvV.'),
(11, 'Lassi king', 'Sepco', '9874563212', '', 5.00, 1, '$2y$10$gxm8vxivmcXx9G/RvuUhresy4rUIHbFWfvWjqBV0pQKLbLRRNvyza'),
(12, 'Home cafe', 'Sepco', '7412589633', '', 5.00, 1, '$2y$10$98O50JiTExLCiq3.YrWWMeQ/5e5iv1FhMcGCexU8pyIx19aSFctdu');

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

--
-- Table structure for table `subscriptions`
--

CREATE TABLE `subscriptions` (
  `id` int(11) NOT NULL,
  `restaurant_id` int(11) NOT NULL,
  `plan` varchar(50) DEFAULT 'monthly',
  `start_date` datetime NOT NULL,
  `expiry_date` datetime NOT NULL,
  `status` enum('active','expired') DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `subscriptions`
--

INSERT INTO `subscriptions` (`id`, `restaurant_id`, `plan`, `start_date`, `expiry_date`, `status`) VALUES
(2, 7, 'demo-1hour', '2025-10-12 00:00:00', '2025-10-12 00:00:00', 'active'),
(3, 8, 'demo-1hour', '2025-10-12 00:00:00', '2025-10-12 00:00:00', 'active'),
(4, 9, 'demo-1hour', '2025-10-13 09:04:36', '2025-10-13 10:04:36', 'active'),
(5, 10, 'demo-1hour', '2025-10-13 09:26:12', '2025-10-13 10:26:12', 'active'),
(6, 11, 'demo-1hour', '2025-12-20 18:49:21', '2026-01-20 18:49:21', 'active'),
(7, 12, 'demo-1hour', '2026-01-02 22:57:28', '2026-02-02 22:57:28', 'active');

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `subscriptions`
--
ALTER TABLE `subscriptions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
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 */;
