-- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Oct 16, 2020 at 05:59 AM
-- Server version: 5.7.24
-- PHP Version: 7.2.11

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `montzo_manufacture`
--

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

--
-- Table structure for table `Bom`
--

DROP TABLE IF EXISTS `Bom`;
CREATE TABLE `Bom` (
  `id` int(11) NOT NULL,
  `bomNumber` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `itemId` int(11) NOT NULL,
  `variantId` int(11) NOT NULL,
  `outputQuantity` double NOT NULL COMMENT 'Quantity Of Items obtained after manufacturing',
  `transferMaterialAginst` int(11) NOT NULL COMMENT '2=>Job Card or 1=>Workorder',
  `branchId` int(11) NOT NULL DEFAULT '1',
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=>Draft, 1=>Publish',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  `deletedAt` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `BomMaterials`
--

DROP TABLE IF EXISTS `BomMaterials`;
CREATE TABLE `BomMaterials` (
  `id` int(11) NOT NULL,
  `bomId` int(11) NOT NULL,
  `linkedOperationId` int(11) NOT NULL,
  `itemId` int(11) NOT NULL,
  `variantId` int(11) NOT NULL DEFAULT '0',
  `quantity` double NOT NULL DEFAULT '0',
  `unitTypeId` int(11) NOT NULL DEFAULT '0',
  `rate` double NOT NULL DEFAULT '0',
  `amount` double NOT NULL DEFAULT '0',
  `sourceWarehouseId` int(11) NOT NULL,
  `scrapPercentage` double NOT NULL COMMENT 'E material E Operation chaithal ithra Waste Varam',
  `branchId` int(11) NOT NULL DEFAULT '1',
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  `deletedAt` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `BomOperations`
--

DROP TABLE IF EXISTS `BomOperations`;
CREATE TABLE `BomOperations` (
  `id` int(11) NOT NULL,
  `bomId` int(11) NOT NULL,
  `operationId` int(11) NOT NULL,
  `workstationId` int(11) NOT NULL,
  `description` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `operationTime` int(11) NOT NULL COMMENT 'in Minute',
  `operationCost` double NOT NULL DEFAULT '0',
  `batchSize` int(11) NOT NULL,
  `branchId` int(11) NOT NULL DEFAULT '1',
  `createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedAt` datetime NOT NULL,
  `deletedAt` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `Brands`
--

DROP TABLE IF EXISTS `Brands`;
CREATE TABLE `Brands` (
  `id` int(11) NOT NULL,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `Countries`
--

DROP TABLE IF EXISTS `Countries`;
CREATE TABLE `Countries` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Countries`
--

INSERT INTO `Countries` (`id`, `name`) VALUES
(1, 'India');

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

--
-- Table structure for table `JobCardOperationStatus`
--

DROP TABLE IF EXISTS `JobCardOperationStatus`;
CREATE TABLE `JobCardOperationStatus` (
  `id` int(11) NOT NULL,
  `jobCardId` int(11) NOT NULL,
  `completedQuantity` double NOT NULL DEFAULT '0',
  `startedAt` datetime DEFAULT NULL,
  `endedAt` datetime DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=>Started,1=>Pause,2=>Completed',
  `createdAt` datetime DEFAULT NULL,
  `updatedAt` datetime DEFAULT NULL,
  `deletedAt` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `JobCards`
--

DROP TABLE IF EXISTS `JobCards`;
CREATE TABLE `JobCards` (
  `id` int(11) NOT NULL,
  `workOrderId` int(11) NOT NULL,
  `number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
  `postingAt` datetime NOT NULL,
  `workstationId` int(11) NOT NULL,
  `operationId` int(11) NOT NULL,
  `remarks` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `employeeId` int(11) NOT NULL,
  `quantityToManufacture` double NOT NULL,
  `wipWarehouse` int(11) NOT NULL,
  `projectId` int(11) NOT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0 = Draft 1 = Published 2 = Cancel	3 = JOB Started 4 = PAUSE, 5 = JOB Completed',
  `createdAt` datetime DEFAULT NULL,
  `updatedAt` datetime DEFAULT NULL,
  `deletedAt` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `PurchaseDetails`
--

DROP TABLE IF EXISTS `PurchaseDetails`;
CREATE TABLE `PurchaseDetails` (
  `id` bigint(20) NOT NULL,
  `purchaseId` bigint(20) NOT NULL DEFAULT '0',
  `itemId` int(11) NOT NULL DEFAULT '0',
  `variantId` int(11) NOT NULL DEFAULT '0',
  `price` double NOT NULL DEFAULT '0',
  `quantity` double NOT NULL DEFAULT '0',
  `gstRate` double NOT NULL DEFAULT '0',
  `cgstAmount` double NOT NULL DEFAULT '0',
  `sgstAmount` double NOT NULL DEFAULT '0',
  `igstAmount` double NOT NULL DEFAULT '0',
  `totalAmount` double NOT NULL DEFAULT '0',
  `cost` double NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `PurchaseFreight`
--

DROP TABLE IF EXISTS `PurchaseFreight`;
CREATE TABLE `PurchaseFreight` (
  `id` bigint(20) NOT NULL,
  `purchaseId` bigint(20) NOT NULL DEFAULT '0',
  `freightRate` double NOT NULL DEFAULT '0',
  `freightGstRate` double NOT NULL DEFAULT '0',
  `freightCgst` double NOT NULL DEFAULT '0',
  `freightSgst` double NOT NULL DEFAULT '0',
  `freightIgst` double NOT NULL DEFAULT '0',
  `freightNetAmount` double NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `Purchases`
--

DROP TABLE IF EXISTS `Purchases`;
CREATE TABLE `Purchases` (
  `id` bigint(20) NOT NULL,
  `invoiceNumber` varchar(30) DEFAULT NULL,
  `invoiceDate` date DEFAULT NULL,
  `referenceNumber` int(11) NOT NULL DEFAULT '0',
  `receivedDate` date DEFAULT NULL,
  `supplierId` int(11) NOT NULL DEFAULT '0',
  `purchaseType` tinyint(4) NOT NULL DEFAULT '0',
  `otherExpense` double NOT NULL DEFAULT '0',
  `discountAmount` double NOT NULL DEFAULT '0',
  `roundOffAmount` double NOT NULL DEFAULT '0',
  `netAmount` double NOT NULL DEFAULT '0',
  `createdAt` datetime DEFAULT NULL,
  `updatedAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `deletedAt` datetime DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `PurchaseTypes`
--

DROP TABLE IF EXISTS `PurchaseTypes`;
CREATE TABLE `PurchaseTypes` (
  `id` tinyint(4) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `PurchaseTypes`
--

INSERT INTO `PurchaseTypes` (`id`, `name`, `status`) VALUES
(1, 'Interstate', 1),
(2, 'Intrastate', 1);

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

--
-- Table structure for table `States`
--

DROP TABLE IF EXISTS `States`;
CREATE TABLE `States` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `countryId` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `States`
--

INSERT INTO `States` (`id`, `name`, `countryId`) VALUES
(1, 'Andhra Pradesh', 1),
(2, 'Arunachal Pradesh', 1),
(3, 'Assam', 1),
(4, 'Bihar', 1),
(5, 'Karnataka', 1),
(6, 'Kerala', 1),
(7, 'Karnataka', 1),
(8, 'Tamil Nadu', 1),
(9, 'Maharashtra', 1),
(10, 'Gujarat', 1);

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

--
-- Table structure for table `Suppliers`
--

DROP TABLE IF EXISTS `Suppliers`;
CREATE TABLE `Suppliers` (
  `id` int(11) NOT NULL,
  `supplierCode` bigint(20) NOT NULL DEFAULT '0',
  `supplierName` varchar(250) DEFAULT NULL,
  `address1` varchar(250) DEFAULT NULL,
  `address2` varchar(250) DEFAULT NULL,
  `pinCode` varchar(10) DEFAULT NULL,
  `phoneNumber` varchar(15) DEFAULT NULL,
  `stateId` tinyint(4) NOT NULL,
  `countryId` tinyint(4) NOT NULL,
  `gstNumber` varchar(20) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

--
-- Indexes for table `States`
--
ALTER TABLE `States`
  ADD PRIMARY KEY (`id`),
  ADD KEY `countryId` (`countryId`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

--
-- AUTO_INCREMENT for table `PurchaseDetails`
--
ALTER TABLE `PurchaseDetails`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `PurchaseFreight`
--
ALTER TABLE `PurchaseFreight`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `Purchases`
--
ALTER TABLE `Purchases`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `PurchaseTypes`
--
ALTER TABLE `PurchaseTypes`
  MODIFY `id` tinyint(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

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

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