-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `devmmaonesalasar_db`
--

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

--
-- Table structure for table `mm_approval_matrix`
--

CREATE TABLE `mm_approval_matrix` (
  `approver_id` int(11) NOT NULL,
  `section_id` int(11) NOT NULL,
  `section` varchar(250) NOT NULL,
  `department` varchar(250) NOT NULL,
  `department_id` int(11) NOT NULL,
  `approvers_id` varchar(250) NOT NULL,
  `appr_name` varchar(250) NOT NULL,
  `material` varchar(250) NOT NULL,
  `material_id` int(11) NOT NULL,
  `level` varchar(50) NOT NULL,
  `from_amount` int(11) NOT NULL,
  `to_amount` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_commercial_questions`
--

CREATE TABLE `mm_commercial_questions` (
  `rfq_commercial_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL DEFAULT '0',
  `cmp_id` int(11) DEFAULT NULL,
  `material_id` int(11) NOT NULL DEFAULT '0',
  `rfq_supplier_id` int(11) NOT NULL DEFAULT '0',
  `rfq_tax_id` int(11) NOT NULL DEFAULT '0',
  `rfq_commercial_question` varchar(255) NOT NULL,
  `rfq_tax_values` decimal(10,2) NOT NULL,
  `rfq_commercial_approval_status` int(11) NOT NULL,
  `rfq_commercial_approval_by` int(11) NOT NULL DEFAULT '0',
  `rfq_commercial_approved_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_company`
--

CREATE TABLE `mm_company` (
  `company_id` int(11) NOT NULL,
  `company_name` text,
  `owner_name` text,
  `address_one` text,
  `address_two` varchar(100) DEFAULT NULL,
  `city` text,
  `state` text,
  `pin_code` int(11) DEFAULT '0',
  `pan_no` varchar(40) DEFAULT NULL,
  `gst_no` varchar(100) DEFAULT NULL,
  `cin` varchar(40) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `contact` varchar(20) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `type_of_business` varchar(100) DEFAULT NULL,
  `description_of_company` varchar(200) DEFAULT NULL,
  `no_of_units` int(11) NOT NULL DEFAULT '0',
  `spoc_name` varchar(50) DEFAULT NULL,
  `spoc_mob` int(11) NOT NULL DEFAULT '0',
  `spoc_email` varchar(100) DEFAULT NULL,
  `spoc_designation` varchar(250) NOT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` text,
  `updated_date` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `updated_by` text,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `mm_company`
--

INSERT INTO `mm_company` (`company_id`, `company_name`, `owner_name`, `address_one`, `address_two`, `city`, `state`, `pin_code`, `pan_no`, `gst_no`, `cin`, `email`, `contact`, `website`, `type_of_business`, `description_of_company`, `no_of_units`, `spoc_name`, `spoc_mob`, `spoc_email`, `spoc_designation`, `created_date`, `created_by`, `updated_date`, `updated_by`, `is_delete`) VALUES
(1, 'Google', 'Larry and sergey ', 'california', 'Palo alto', '', '', 345345, '52525', '424', '23525', 'test@gmail.com', '525252', '', '', '', 0, 'Larry', 2147483647, '', '', '2024-06-12 14:59:03', '', '2024-06-12 14:59:03.168043', NULL, 0),
(2, 'Salasar Pvt Ltd', 'Priyanka ', 'Opal Square IT Park', 'Thane', 'Mumbai', 'Maharashtra', 400604, 'ABCDE1234F', 'ABCD1234567AA', 'AAAAAA', 'salasar_123@gmail.com', '2147483647', 'www.salasar.com', 'Salasar Pvt Ltd.', 'tetsing okm ', 5, 'Priyanka ', 2147483647, 'priyanka.kulkarni@salasarauction.com', 'Tester', '2024-06-12 18:08:02', '', '2024-06-12 18:08:02.546490', '', 0),
(4, 'Bhagyashri PVT LTD', 'Bhagyashri Patil', 'Airoli', 'Thane ', 'Mumbai', 'Maharashtra', 400602, 'GFH1122KK', '09AAACH7409R1ZZ', 'sgh24567', 'bhagyashri.patil@salasarauction.com', '2147483647', 'https: mm.aonesalasar.com/', 'Manufacturer', '', 0, 'Bhagyashri Patil', 2147483647, '', '', '2024-06-13 14:02:09', '', '2024-06-13 14:02:09.145333', NULL, 0),
(5, 'Priyanka Kulakrni ', 'Priyanka ', 'Thane', 'Mulund', 'Mumbai', 'Maharashtra', 400604, 'ABCDE1234F', 'ABCD1234567AA11', 'AAAAAABBBB', 'salasar_123@gmail.com', '2147483647', 'www.poojasteels.com', 'Salasar Pvt Ltd.', 'sdgSDgSdgsdg', 111, 'Priyanka ', 2147483647, 'priyanka.kulkarni@salasarauction.com', 'Software Tester', '2024-06-17 12:59:13', '', '2024-06-17 12:59:13.797531', NULL, 0),
(6, 'Trimurthi_Traders', 'Sachin Shinde', 'Thane West , Wagle Estate', 'Thane West , Wagle Estate', 'Thane', 'Maharashtra', 400604, 'PAN0014628', 'GSTN00112', 'CIN009', 'sachinshindepatilroyal007@gmail.com', '2147483647', 'trimurthi.com', 'Dry Fruits', 'Huge Level of Dry Fruits Sale', 10, 'Sachin Shinde', 2147483647, 'sachinshindepatilroyal007@gmail.com', 'CEO', '2024-06-17 17:53:37', '', '2024-06-17 17:53:37.502389', NULL, 0),
(9, 'Neeraj Pvt Ltd', 'Neeraj Chaudhary ', 'Parel ', 'Mumbai ', 'Mumbai ', 'Maharashtra', 400602, 'ABCDE01234FGH', '09AAACH7409R1ZZ', 'sgh24567', 'neeraj.chaudhary@salasarauction.com', '2147483647', 'https: mm.aonesalasar.com/company/masters/Company/index', 'Manufacturer', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 1, 'Bhagyashri Patil', 2147483647, 'bhagyashri.patil@salasarauction.com', 'Test ', '2024-06-29 10:13:41', '', '2024-06-29 10:13:41.544111', '', 0),
(10, 'SURAJ PVT LTD ', 'Suraj Yadav', 'Opal Square, Thane West, Mumbai ', 'Mumbai 400604 ', 'Mumbai', 'Maharashtra', 400604, 'GFH1122KK', '09AAACH7409R1ZZ', 'sgh24567', 'bhagyashri.patil@salasarauction.com', '2147483647', 'https: mm.aonesalasar.com/', 'Manufacturer', 'Materials management uses inventories and production requirements for planning and control to ensure materials are available as required to meet production schedules. This material planning includes m', 1, 'Suraj Yadav ', 2147483647, 'suraj.yadav@salasarauction.com', 'Test 111', '2024-07-08 12:14:23', '', '2024-07-08 12:14:23.276119', NULL, 0),
(11, 'ABC Manufacturing Pvt Ltd', 'John Doe', '123 Industrial Park Avenue', 'Suite 456', 'Mumbai', 'Maharashtra', 400001, 'ABCDE1234F', '27ABCDE1234F1Z5', 'U12345MH2024PTC012345', 'contact@abcmfg.com', '9876543210', 'www.abcmfg.com', 'Manufacturing and Wholesale', 'ABC Manufacturing Pvt Ltd specializes in producing high-quality industrial equipment and machinery. With over 20 years of experience, we serve clients across India, providing durable products and exce', 3, 'Rajesh Kumar', 2147483647, 'rajesh.kumar@abcmfg.com', 'Head of Operations', '2024-11-06 15:05:53', '', '2024-11-06 15:05:53.318007', NULL, 0);

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

--
-- Table structure for table `mm_company_budget`
--

CREATE TABLE `mm_company_budget` (
  `company_budget_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `company_budget` decimal(10,3) NOT NULL,
  `budget_type` enum('project','fin_yr') DEFAULT NULL,
  `financial_year` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_contact_person`
--

CREATE TABLE `mm_contact_person` (
  `contact_person_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `plant_id` int(11) DEFAULT NULL,
  `c_name` varchar(255) NOT NULL,
  `c_number` varchar(20) NOT NULL,
  `c_email` varchar(100) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_currency`
--

CREATE TABLE `mm_currency` (
  `currency_id` int(11) NOT NULL,
  `currency_code` varchar(500) DEFAULT NULL,
  `currency_name` varchar(500) DEFAULT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_department`
--

CREATE TABLE `mm_department` (
  `department_id` int(11) NOT NULL,
  `plant_id` varchar(255) NOT NULL,
  `division_id` int(11) DEFAULT NULL,
  `cmp_id` int(11) NOT NULL,
  `sub_division_id` int(11) DEFAULT NULL,
  `department_code` varchar(255) NOT NULL,
  `department_name` varchar(255) NOT NULL,
  `department_budget` decimal(10,2) DEFAULT NULL,
  `otb_budget` int(11) NOT NULL,
  `otb_budget_percentage` varchar(11) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_designation`
--

CREATE TABLE `mm_designation` (
  `designation_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `designation` varchar(255) NOT NULL,
  `department` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_division`
--

CREATE TABLE `mm_division` (
  `division_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `plant_id` int(11) NOT NULL,
  `plant_code` varchar(255) NOT NULL,
  `division_code` varchar(255) NOT NULL,
  `division_name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_division_budget`
--

CREATE TABLE `mm_division_budget` (
  `mm_division_budget_id` int(11) NOT NULL,
  `plant_id` int(11) NOT NULL,
  `division_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `budget` varchar(100) DEFAULT NULL,
  `plant_budget` varchar(30) DEFAULT NULL,
  `available_budget` varchar(30) DEFAULT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) DEFAULT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_employee_permissions`
--

CREATE TABLE `mm_employee_permissions` (
  `employee_permission_id` int(11) NOT NULL,
  `employee_id` int(11) NOT NULL,
  `module_id` varchar(11) NOT NULL,
  `sub_module_id` varchar(11) NOT NULL,
  `permission_id` varchar(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_financial_document`
--

CREATE TABLE `mm_financial_document` (
  `financial_document_id` int(11) NOT NULL,
  `financial_document_number` varchar(255) NOT NULL,
  `grn_id` int(11) DEFAULT NULL,
  `grn_no` varchar(50) DEFAULT NULL,
  `grn_suppilier_id` int(11) NOT NULL,
  `grn_date` datetime DEFAULT NULL,
  `po_no` varchar(50) DEFAULT NULL,
  `delivery_date` datetime DEFAULT NULL,
  `vendor_code` varchar(255) NOT NULL,
  `grn_from` varchar(100) DEFAULT NULL,
  `grn_to` varchar(100) DEFAULT NULL,
  `plant_code` varchar(255) NOT NULL,
  `ge_no` varchar(50) DEFAULT NULL,
  `bill_no` varchar(50) DEFAULT NULL,
  `challan_no` varchar(50) DEFAULT NULL,
  `challan_qty` decimal(10,2) DEFAULT NULL,
  `lr_no` varchar(50) DEFAULT NULL,
  `transporter` varchar(100) DEFAULT NULL,
  `vehicle_no` varchar(50) DEFAULT NULL,
  `Fin_docu_taxes` text NOT NULL,
  `findoc_prepared_by` varchar(255) NOT NULL,
  `grn_prepared_by` varchar(100) DEFAULT NULL,
  `inspected_by` varchar(100) DEFAULT NULL,
  `hod` varchar(100) DEFAULT NULL,
  `account_manager` varchar(100) DEFAULT NULL,
  `status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved,\r\nR=Reject,\r\n\r\n',
  `created_by` int(11) DEFAULT NULL,
  `company_id` int(11) DEFAULT NULL,
  `created_on` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_financial_document_approvals`
--

CREATE TABLE `mm_financial_document_approvals` (
  `financial_document_approval_id` int(11) NOT NULL,
  `financial_document_id` int(11) NOT NULL,
  `approval_status` enum('P','A','R','RE') NOT NULL COMMENT 'P=Pending, \r\nA=Approved,\r\nR=Reject,\r\nRE=Revise',
  `status_reason` text NOT NULL,
  `status_by` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_financial_document_materials`
--

CREATE TABLE `mm_financial_document_materials` (
  `financial_document_material_id` int(11) NOT NULL,
  `financial_document_id` int(11) DEFAULT NULL,
  `material` varchar(255) NOT NULL,
  `po_qty` decimal(10,2) DEFAULT NULL,
  `received_qty` decimal(10,2) DEFAULT NULL,
  `accepted_qty` decimal(10,2) DEFAULT NULL,
  `access_qty` decimal(10,2) DEFAULT NULL,
  `short_qty` decimal(10,2) DEFAULT NULL,
  `rejected_qty` decimal(10,2) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `discount` decimal(10,2) DEFAULT NULL,
  `total_value` decimal(15,2) DEFAULT NULL,
  `other_value1` decimal(10,2) NOT NULL,
  `other_value2` decimal(10,2) NOT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0',
  `company_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_grn`
--

CREATE TABLE `mm_grn` (
  `grn_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `grn_no` varchar(255) NOT NULL,
  `po_id` varchar(255) NOT NULL,
  `grn_date_time` datetime NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `supplier` varchar(255) NOT NULL,
  `address` varchar(255) NOT NULL,
  `ge_no` varchar(255) NOT NULL,
  `ge_date` date DEFAULT NULL,
  `bill_no` varchar(255) NOT NULL,
  `bill_date` date DEFAULT NULL,
  `challan_no` varchar(255) NOT NULL,
  `challan_date` date DEFAULT NULL,
  `lr_no` varchar(255) NOT NULL,
  `lr_date` date DEFAULT NULL,
  `transporter_name` varchar(255) NOT NULL,
  `transporter_contact` varchar(20) NOT NULL,
  `vehicle_no` varchar(255) NOT NULL,
  `delivery_date_time` datetime NOT NULL,
  `quality_assurance_code` varchar(255) NOT NULL,
  `supporting_docs` varchar(200) NOT NULL,
  `delivery_rating` int(11) NOT NULL DEFAULT '0',
  `behaviour_rating` int(11) NOT NULL DEFAULT '0',
  `quality_rating` int(11) NOT NULL DEFAULT '0',
  `overall_experience_rating` int(11) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_grn_approved`
--

CREATE TABLE `mm_grn_approved` (
  `approved_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `status` enum('accept','reject','revise') NOT NULL,
  `reason` varchar(100) NOT NULL,
  `approved_by` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_grn_inspected_materials`
--

CREATE TABLE `mm_grn_inspected_materials` (
  `inspected_mat_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `inspect_id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `grn_no` varchar(100) NOT NULL,
  `po_no` varchar(100) NOT NULL,
  `material_code` varchar(100) NOT NULL,
  `mat_id` int(11) NOT NULL,
  `short_desc` varchar(255) NOT NULL,
  `unit` varchar(100) NOT NULL,
  `challan_qty` decimal(10,2) NOT NULL,
  `received_qty` decimal(10,2) NOT NULL,
  `short_qty` decimal(10,2) NOT NULL,
  `excess_qty` decimal(10,2) NOT NULL,
  `accepted_qty` decimal(10,2) NOT NULL,
  `rejected_qty` decimal(10,2) NOT NULL,
  `blc` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_grn_inspection`
--

CREATE TABLE `mm_grn_inspection` (
  `inspection_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `supplier` varchar(255) NOT NULL,
  `status` enum('Pending','Done') NOT NULL DEFAULT 'Pending',
  `send_for_approval` enum('Y','N') NOT NULL DEFAULT 'N',
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_grn_materials`
--

CREATE TABLE `mm_grn_materials` (
  `grn_mat_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `mat_id` int(11) NOT NULL,
  `received_qty` decimal(10,2) NOT NULL,
  `challan_qty` decimal(10,2) NOT NULL,
  `accepted_qty` decimal(10,2) NOT NULL,
  `pending_qty` decimal(10,2) NOT NULL,
  `po_qty` decimal(10,2) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_grn_sended`
--

CREATE TABLE `mm_grn_sended` (
  `grn_sended_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `grn_sended` enum('Y','N') NOT NULL,
  `grn_sended_by` int(11) NOT NULL,
  `grn_sended_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_inventory_difference`
--

CREATE TABLE `mm_inventory_difference` (
  `id` int(11) NOT NULL,
  `plant_id` int(11) DEFAULT NULL,
  `material_id` int(11) DEFAULT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `title` text,
  `mat_description` text,
  `bin_location` varchar(255) DEFAULT NULL,
  `mat_unit_id` int(11) DEFAULT NULL,
  `availiable_qty` int(11) DEFAULT NULL,
  `diff_quantity` int(11) DEFAULT NULL,
  `date_of_incident` datetime DEFAULT NULL,
  `voucher_desc` text,
  `first_approval` int(11) DEFAULT NULL,
  `second_approval` int(11) DEFAULT NULL,
  `third_approval` int(11) DEFAULT NULL,
  `first_approval_status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=''Pending'', A=''Approved,R=''rejected''',
  `second_approval_status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=''Pending'', A=''Approved,R=''rejected''',
  `third_approval_status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=''Pending'', A=''Approved,R=''rejected''',
  `first_approval_status_updated_by` int(11) DEFAULT NULL,
  `second_approval_status_updated_by` int(11) DEFAULT NULL,
  `third_approval_status_updated_by` int(11) DEFAULT NULL,
  `first_approval_status_updated_date` datetime DEFAULT NULL,
  `second_approval_status_updated_date` datetime DEFAULT NULL,
  `third_approval_status_updated_date` datetime DEFAULT NULL,
  `file_name` varchar(255) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_date` datetime DEFAULT NULL,
  `is_delete` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_inventory_flow`
--

CREATE TABLE `mm_inventory_flow` (
  `inventory_id` int(11) NOT NULL,
  `material_id` int(11) NOT NULL,
  `material` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `unit` varchar(255) NOT NULL,
  `opening_bal` int(11) NOT NULL,
  `used_qty` int(11) NOT NULL DEFAULT '0',
  `bin_location` varchar(255) NOT NULL,
  `usage_description` varchar(255) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_inventory_flow_logs`
--

CREATE TABLE `mm_inventory_flow_logs` (
  `log_id` int(11) NOT NULL,
  `operation_type` varchar(50) NOT NULL,
  `data` text NOT NULL,
  `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_inventory_grn`
--

CREATE TABLE `mm_inventory_grn` (
  `grn_id` int(11) NOT NULL,
  `grn_no` varchar(255) NOT NULL,
  `purchase_order_no` varchar(255) NOT NULL,
  `grn_date_time` datetime NOT NULL,
  `supplier` varchar(255) NOT NULL,
  `address` varchar(255) NOT NULL,
  `ge_no` varchar(255) NOT NULL,
  `bill_no` varchar(255) NOT NULL,
  `challan_no` varchar(255) NOT NULL,
  `lr_no` varchar(255) NOT NULL,
  `transporter_name` varchar(255) NOT NULL,
  `transporter_contact` varchar(20) NOT NULL,
  `storage_location` varchar(255) NOT NULL,
  `bin_location` varchar(255) NOT NULL,
  `vehicle_no` varchar(255) NOT NULL,
  `rate` varchar(255) NOT NULL,
  `discount` int(11) NOT NULL,
  `delivery_date_time` datetime NOT NULL,
  `material_id` int(11) NOT NULL,
  `item_code` varchar(255) NOT NULL,
  `item_description` text NOT NULL,
  `uom` varchar(50) NOT NULL,
  `challan_qty` int(11) NOT NULL,
  `received_qty` int(11) NOT NULL,
  `purchase_order_qty` int(11) NOT NULL,
  `short_qty` int(11) NOT NULL,
  `exceed_qty` int(11) NOT NULL,
  `rejected_qty` int(11) NOT NULL,
  `accepted_qty` int(11) NOT NULL,
  `value_accepted_qty` int(11) NOT NULL,
  `inspection_required` enum('Yes','No') NOT NULL DEFAULT 'No',
  `quality_assurance_code` varchar(255) NOT NULL,
  `supporting_docs` varchar(200) NOT NULL,
  `delivery_rating` int(11) NOT NULL DEFAULT '0',
  `behaviour_rating` int(11) NOT NULL DEFAULT '0',
  `quality_rating` int(11) NOT NULL DEFAULT '0',
  `overall_experience_rating` int(11) NOT NULL DEFAULT '0',
  `send_grn` tinyint(1) NOT NULL DEFAULT '0',
  `send_grn_datetime` datetime DEFAULT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoice`
--

CREATE TABLE `mm_invoice` (
  `invoice_id` int(11) NOT NULL,
  `po_no` varchar(255) NOT NULL,
  `grn_no` varchar(255) NOT NULL,
  `invoice_no` varchar(100) NOT NULL,
  `supplier_name` varchar(100) NOT NULL,
  `email_id` varchar(100) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `gst` decimal(10,2) NOT NULL,
  `other_taxes` decimal(10,2) NOT NULL,
  `handling_cost` decimal(10,2) NOT NULL,
  `transport_cost` decimal(10,2) NOT NULL,
  `total_cost` decimal(10,2) NOT NULL,
  `date` date NOT NULL,
  `raised_by` varchar(20) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoices`
--

CREATE TABLE `mm_invoices` (
  `invoice_id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `invoice_number` varchar(255) NOT NULL,
  `invoice_date` date NOT NULL,
  `additional_charges` decimal(10,2) NOT NULL,
  `mat_sub_total` decimal(10,2) NOT NULL,
  `tax_sub_total` decimal(10,2) NOT NULL,
  `grand_total` decimal(10,2) NOT NULL,
  `status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved,\r\nR=Reject,\r\nRE=Revise',
  `closed_invoice` enum('Yes','No') NOT NULL DEFAULT 'No',
  `invoice_send` enum('Yes','No') NOT NULL DEFAULT 'No',
  `invoice_send_by` int(11) DEFAULT NULL,
  `invoice_send_date` datetime DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoices_approval`
--

CREATE TABLE `mm_invoices_approval` (
  `approved_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `status` enum('P','A','R','RE') NOT NULL DEFAULT 'P',
  `status_reason` varchar(100) NOT NULL,
  `approved_by` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoices_company_approvals`
--

CREATE TABLE `mm_invoices_company_approvals` (
  `mm_invoices_company_approvals_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved,\r\nR=Reject',
  `status_reason` text NOT NULL,
  `status_by` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoices_materials`
--

CREATE TABLE `mm_invoices_materials` (
  `mm_invoice_material_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `company` varchar(255) NOT NULL,
  `material_name` varchar(255) DEFAULT NULL,
  `mat_quantity` varchar(255) NOT NULL,
  `mat_unit` varchar(255) NOT NULL,
  `mat_unit_price` decimal(10,2) NOT NULL,
  `mat_sub_total` varchar(255) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoices_taxes`
--

CREATE TABLE `mm_invoices_taxes` (
  `mm_invoices_taxes_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `taxes` varchar(255) NOT NULL,
  `percent` varchar(255) NOT NULL,
  `tax_amount` decimal(10,2) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_invoice_closed`
--

CREATE TABLE `mm_invoice_closed` (
  `invoice_closed_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `utr_no` int(11) NOT NULL,
  `closed_by` int(11) NOT NULL,
  `closed_date` datetime NOT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_materials`
--

CREATE TABLE `mm_materials` (
  `material_id` int(11) NOT NULL,
  `material_code` varchar(255) NOT NULL,
  `material_name` varchar(255) NOT NULL,
  `title` text NOT NULL,
  `brief_description` text NOT NULL,
  `technical_description` text NOT NULL,
  `commercial_description` text NOT NULL,
  `average_price` varchar(100) NOT NULL,
  `preservation_code` varchar(100) NOT NULL,
  `category` varchar(255) NOT NULL,
  `hsn_code` varchar(255) NOT NULL,
  `minimum_balance` varchar(40) NOT NULL,
  `quantity` varchar(250) NOT NULL,
  `reorder_level` varchar(40) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_material_category`
--

CREATE TABLE `mm_material_category` (
  `material_category_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `category_name` varchar(40) DEFAULT NULL,
  `description` varchar(40) DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_material_consumed`
--

CREATE TABLE `mm_material_consumed` (
  `mm_material_consumed_id` int(11) NOT NULL,
  `material_id` int(11) NOT NULL,
  `mat_qty` int(11) NOT NULL,
  `mat_description` text NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_material_plant`
--

CREATE TABLE `mm_material_plant` (
  `mm_material_plant_id` int(11) NOT NULL,
  `mm_material_id` int(11) DEFAULT NULL,
  `plant_id` int(11) DEFAULT NULL,
  `plant_code` varchar(50) DEFAULT NULL,
  `bin_location` text,
  `cmp_id` int(11) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_date` datetime DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_material_unit`
--

CREATE TABLE `mm_material_unit` (
  `mm_material_unit_id` int(11) NOT NULL,
  `mm_material_id` int(11) DEFAULT NULL,
  `mm_material_unit_code` varchar(50) DEFAULT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_date` datetime DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_page_permissions`
--

CREATE TABLE `mm_page_permissions` (
  `mm_page_permissions_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `module_id` int(11) NOT NULL,
  `sub_module_id` int(11) NOT NULL,
  `page_permission_name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_payments_terms`
--

CREATE TABLE `mm_payments_terms` (
  `payment_terms_id` int(11) NOT NULL,
  `payment_terms` text NOT NULL,
  `status` varchar(255) NOT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cmp_id` int(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_permissions`
--

CREATE TABLE `mm_permissions` (
  `permission_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `module` varchar(40) NOT NULL,
  `sub_module` varchar(40) NOT NULL,
  `page_permission` int(11) DEFAULT NULL,
  `permissions` varchar(255) NOT NULL,
  `department` varchar(255) NOT NULL,
  `designation` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_permission_module`
--

CREATE TABLE `mm_permission_module` (
  `permission_module_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `module` varchar(40) NOT NULL,
  `description` text NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_permission_submodule`
--

CREATE TABLE `mm_permission_submodule` (
  `permission_sub_module_id` int(11) NOT NULL,
  `permission_module_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `sub_module` varchar(40) NOT NULL,
  `description` text NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_plants`
--

CREATE TABLE `mm_plants` (
  `plant_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `plant_code` varchar(255) NOT NULL,
  `plant_name` varchar(255) NOT NULL,
  `location_one` text NOT NULL,
  `location_two` text NOT NULL,
  `location_three` text NOT NULL,
  `description` text NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_plant_budget`
--

CREATE TABLE `mm_plant_budget` (
  `plant_budget_id` int(11) NOT NULL,
  `plant_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `plant_code` varchar(100) NOT NULL,
  `plant_budget` varchar(100) NOT NULL,
  `company_budget` varchar(100) NOT NULL,
  `available_budget` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_po_approvals`
--

CREATE TABLE `mm_po_approvals` (
  `po_approval_id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `approval_status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending,A=Approved, R=Reject',
  `approval_remarks` text NOT NULL,
  `approved_by` int(11) NOT NULL,
  `approved_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `cmp_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_po_invoice`
--

CREATE TABLE `mm_po_invoice` (
  `po_invoice_id` int(11) NOT NULL,
  `po_number` varchar(255) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `grn_number` varchar(255) NOT NULL,
  `invoice_number` varchar(255) NOT NULL,
  `supplier_bill_no` varchar(255) NOT NULL,
  `grn_date` date NOT NULL,
  `invoice_qty` varchar(255) NOT NULL,
  `uom` varchar(100) NOT NULL,
  `currency` varchar(255) NOT NULL,
  `taxes` varchar(255) NOT NULL,
  `status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved,\r\nR=Reject,\r\nRE=Revise',
  `closed_invoice` enum('Yes','No') NOT NULL DEFAULT 'No',
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_po_invoice_approvals`
--

CREATE TABLE `mm_po_invoice_approvals` (
  `invoice_approval_id` int(11) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved,\r\nR=Reject,\r\nRE=Revise',
  `status_reason` text,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_po_masters`
--

CREATE TABLE `mm_po_masters` (
  `po_id` int(11) NOT NULL,
  `po_type` varchar(255) NOT NULL,
  `po_number` varchar(255) NOT NULL,
  `order_date` date NOT NULL,
  `delivery_date` date NOT NULL,
  `rfq_number` varchar(255) DEFAULT NULL,
  `purchase_proposal_no` varchar(255) DEFAULT NULL,
  `po_value` varchar(255) NOT NULL,
  `period_of_supply` varchar(255) NOT NULL,
  `additional_value` varchar(255) NOT NULL,
  `payment_terms` varchar(255) NOT NULL,
  `tax` varchar(255) NOT NULL,
  `total_value` varchar(255) NOT NULL,
  `rate_contract_validity` date DEFAULT NULL,
  `comments` text,
  `quality_standards` varchar(255) DEFAULT NULL,
  `Attachment` varchar(255) NOT NULL,
  `approve_status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved,\r\nR=Reject,\r\nRE=Revise',
  `approve_status_remark` varchar(255) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_po_materials`
--

CREATE TABLE `mm_po_materials` (
  `po_material_id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `po_parent_code` varchar(255) NOT NULL,
  `po_material_code` varchar(255) DEFAULT NULL,
  `rfq_material_relation_id` int(11) NOT NULL DEFAULT '0',
  `material_id` int(11) NOT NULL,
  `material_code` varchar(255) NOT NULL,
  `short_desc` text NOT NULL,
  `long_desc` text NOT NULL,
  `quantity` varchar(255) NOT NULL,
  `unit` varchar(255) NOT NULL,
  `unit_price` varchar(255) NOT NULL,
  `plant` varchar(255) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `mat_attachment` varchar(255) DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `company_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_po_supplier_suggestion`
--

CREATE TABLE `mm_po_supplier_suggestion` (
  `po_supplier_suggestion_id` int(11) NOT NULL,
  `po_id` int(11) NOT NULL,
  `po_material_code` varchar(255) NOT NULL,
  `material_id` int(11) NOT NULL,
  `material_code` varchar(255) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `cmp_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_price_basis`
--

CREATE TABLE `mm_price_basis` (
  `price_basis_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `price_basis_name` varchar(255) DEFAULT NULL,
  `price_basis_percent` int(11) DEFAULT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) DEFAULT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updated_by` int(11) DEFAULT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_pr_allocated`
--

CREATE TABLE `mm_pr_allocated` (
  `pr_allocated_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `pr_id` varchar(255) NOT NULL,
  `allocated_to` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_pr_approvals`
--

CREATE TABLE `mm_pr_approvals` (
  `pr_approval_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `pr_id` int(11) NOT NULL,
  `approval_status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending,A=Approved, R=Reject',
  `approval_remarks` text NOT NULL,
  `approved_by` int(11) NOT NULL,
  `approved_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_pr_master`
--

CREATE TABLE `mm_pr_master` (
  `pr_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `pr_number` varchar(255) NOT NULL,
  `type_of_requisition` varchar(255) NOT NULL,
  `project_name` varchar(255) NOT NULL,
  `project_code` varchar(255) NOT NULL,
  `pr_budget` varchar(255) NOT NULL,
  `pr_stock_availability` varchar(255) NOT NULL,
  `pr_plant_code` varchar(255) NOT NULL,
  `pr_division_code` varchar(255) NOT NULL,
  `pr_department_code` varchar(255) NOT NULL,
  `pr_delivery_date` date DEFAULT NULL,
  `pr_comment` text NOT NULL,
  `pr_allocate_to` int(11) DEFAULT NULL,
  `employee_id` int(11) NOT NULL,
  `approve_status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved, R=Reject,\r\nRE= Revise',
  `approve_status_remark` text NOT NULL,
  `send_pr` enum('Yes','No') NOT NULL DEFAULT 'No',
  `department_id` int(11) NOT NULL,
  `pr_freezed` enum('Yes','No') NOT NULL DEFAULT 'No',
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_pr_materials`
--

CREATE TABLE `mm_pr_materials` (
  `pr_material_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `pr_id` int(11) NOT NULL,
  `material_id` int(11) NOT NULL,
  `material_code` varchar(255) NOT NULL,
  `short_desc` text NOT NULL,
  `long_desc` text NOT NULL,
  `quantity` varchar(255) NOT NULL,
  `unit` varchar(255) NOT NULL,
  `unit_price` varchar(255) NOT NULL,
  `reference_rate` varchar(255) NOT NULL,
  `mat_stock_availability` varchar(255) DEFAULT NULL,
  `mat_attachment` varchar(255) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_pr_supplier_suggestion`
--

CREATE TABLE `mm_pr_supplier_suggestion` (
  `supplier_suggestion_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `pr_id` int(11) NOT NULL,
  `material_id` int(11) NOT NULL,
  `material_code` varchar(255) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_puchase_order_direct`
--

CREATE TABLE `mm_puchase_order_direct` (
  `purchase_order_direct_id` int(11) NOT NULL,
  `order_date` date NOT NULL,
  `order_time` time NOT NULL,
  `delivery_date` date NOT NULL,
  `delivery_time` time NOT NULL,
  `period_of_supply` varchar(255) NOT NULL,
  `payment_terms` varchar(255) NOT NULL,
  `purchase_order_value` varchar(255) NOT NULL,
  `additional_value` varchar(100) NOT NULL,
  `total_value` varchar(100) NOT NULL,
  `material_code` varchar(100) NOT NULL,
  `short_description` text NOT NULL,
  `long_description` text NOT NULL,
  `quantity` varchar(100) NOT NULL,
  `unit` varchar(100) NOT NULL,
  `plant` varchar(100) NOT NULL,
  `supplier_name` varchar(100) NOT NULL,
  `budget` varchar(100) NOT NULL,
  `status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved, R=Reject',
  `document` varchar(255) NOT NULL,
  `approved_by` int(11) NOT NULL DEFAULT '0',
  `approval_date` date NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_puchase_order_rate_contract`
--

CREATE TABLE `mm_puchase_order_rate_contract` (
  `purchase_order_rc_id` int(11) NOT NULL,
  `purchase_order_type` varchar(100) NOT NULL,
  `purchase_order_number` varchar(100) NOT NULL,
  `rfq_number` varchar(100) NOT NULL,
  `purchase_proposal_no` varchar(100) NOT NULL,
  `period_of_supply` varchar(100) NOT NULL,
  `payment_terms` varchar(100) NOT NULL,
  `quality_standard` varchar(100) NOT NULL,
  `order_date` date NOT NULL,
  `order_time` time NOT NULL,
  `rate_contract_validity` datetime NOT NULL,
  `delivery_date` date NOT NULL,
  `delivery_time` time NOT NULL,
  `purchase_order_value` varchar(100) NOT NULL,
  `additional_value` varchar(255) NOT NULL,
  `total_value` varchar(255) NOT NULL,
  `comments` varchar(255) NOT NULL,
  `material` varchar(255) NOT NULL,
  `material_code` varchar(100) NOT NULL,
  `short_description` text NOT NULL,
  `long_description` text NOT NULL,
  `quantity` varchar(255) NOT NULL,
  `unit` text NOT NULL,
  `plant` varchar(255) NOT NULL,
  `supplier_name` varchar(255) NOT NULL,
  `budget` varchar(255) NOT NULL,
  `status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved, R=Reject',
  `approved_by` int(11) NOT NULL DEFAULT '0',
  `document` varchar(255) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_purchase_order_material_details`
--

CREATE TABLE `mm_purchase_order_material_details` (
  `material_id` int(11) NOT NULL,
  `material_code` varchar(255) NOT NULL,
  `short_description` text NOT NULL,
  `long_description` text NOT NULL,
  `quantity` varchar(255) NOT NULL,
  `unit` text NOT NULL,
  `plant` varchar(255) NOT NULL,
  `supplier` varchar(255) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_purchase_order_rfq`
--

CREATE TABLE `mm_purchase_order_rfq` (
  `purchase_order_rfq_id` int(11) NOT NULL,
  `purchase_order_type` varchar(100) NOT NULL,
  `order_date` date NOT NULL,
  `order_time` time NOT NULL,
  `delivery_date` date NOT NULL,
  `delivery_time` time NOT NULL,
  `purchase_proposal_number` varchar(255) NOT NULL,
  `purchase_order_value` varchar(255) NOT NULL,
  `period_of_supply` varchar(100) NOT NULL,
  `additional_value` varchar(255) NOT NULL,
  `payment_terms` varchar(255) NOT NULL,
  `total_value` varchar(255) NOT NULL,
  `material_code` varchar(100) NOT NULL,
  `short_description` text NOT NULL,
  `long_description` text NOT NULL,
  `quantity` varchar(255) NOT NULL,
  `unit` varchar(255) NOT NULL,
  `plant` varchar(100) NOT NULL,
  `supplier` varchar(255) NOT NULL,
  `budget` varchar(255) NOT NULL,
  `status` enum('P','A','R') NOT NULL DEFAULT 'P' COMMENT 'P=Pending, A=Approved, R=Reject',
  `document` varchar(255) NOT NULL,
  `approved_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_ra_auc_t_c`
--

CREATE TABLE `mm_ra_auc_t_c` (
  `rev_t_c_id` int(11) NOT NULL,
  `rev_auction_id` varchar(255) NOT NULL,
  `supplier_id` int(11) NOT NULL DEFAULT '0',
  `t_c` enum('0','1') NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_ra_lot_bid_details`
--

CREATE TABLE `mm_ra_lot_bid_details` (
  `bid_id` int(11) NOT NULL,
  `rev_auc_id` int(11) NOT NULL,
  `lot_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `bid_quantity` int(11) NOT NULL,
  `bid_unit` varchar(50) NOT NULL,
  `bid_amt` decimal(10,2) NOT NULL,
  `bid_date` date NOT NULL,
  `bid_time` time NOT NULL,
  `bidder_ip` varchar(50) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_ra_materials`
--

CREATE TABLE `mm_ra_materials` (
  `ra_mat_id` int(11) NOT NULL,
  `ra_rev_aucid` int(11) NOT NULL,
  `ra_pr_id` int(11) NOT NULL,
  `ra_rfq_id` int(11) NOT NULL,
  `ra_supplier_name` varchar(255) NOT NULL,
  `ra_supplier_id` int(11) NOT NULL,
  `ra_mat_code` varchar(10) NOT NULL,
  `ra_mat_name` varchar(255) NOT NULL,
  `ra_description` varchar(255) NOT NULL,
  `ra_quantity` int(11) NOT NULL DEFAULT '0',
  `ra_bid_quantity` int(11) NOT NULL DEFAULT '0',
  `ra_unit` varchar(50) NOT NULL,
  `ra_amt` decimal(10,2) NOT NULL DEFAULT '0.00',
  `ra_start_price` decimal(10,2) NOT NULL DEFAULT '0.00',
  `ra_min_decr` decimal(10,2) NOT NULL DEFAULT '0.00',
  `ra_plant` varchar(50) NOT NULL,
  `ra_lot_id` int(11) DEFAULT NULL,
  `club` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_ra_rfq`
--

CREATE TABLE `mm_ra_rfq` (
  `ra_rfq_rev_id` int(11) NOT NULL,
  `ra_rfq_number` varchar(20) NOT NULL DEFAULT '',
  `ra_rfq_start_date` date DEFAULT NULL,
  `ra_rfq_start_time` time NOT NULL,
  `ra_rfq_end_date` date DEFAULT NULL,
  `ra_rfq_end_time` time NOT NULL,
  `ra_rfq_company_id` int(11) NOT NULL DEFAULT '0',
  `ra_rfq_pr_id` int(11) NOT NULL DEFAULT '0',
  `ra_rfq_material_id` int(11) NOT NULL DEFAULT '0',
  `ra_rfq_currency` enum('INR','USD','EUR') NOT NULL DEFAULT 'INR',
  `ra_rfq_quote_by` int(11) NOT NULL DEFAULT '0',
  `ra_rfq_show_l1_bid` tinyint(1) NOT NULL DEFAULT '0',
  `ra_rfq_show_bidder_name` tinyint(1) NOT NULL DEFAULT '0',
  `ra_rfq_show_partbid_accepted` tinyint(1) NOT NULL DEFAULT '0',
  `ra_rfq_show_competitors_name` tinyint(1) NOT NULL DEFAULT '0',
  `ra_rfq_supplier_id` int(11) NOT NULL DEFAULT '0',
  `ra_rfq_sale_no` varchar(20) NOT NULL,
  `ra_rfq_auction_type` varchar(20) NOT NULL DEFAULT 'REVERSE',
  `ra_rfq_terms_n_conditions` varchar(255) DEFAULT '',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_reverse_auction`
--

CREATE TABLE `mm_reverse_auction` (
  `rev_auc_id` int(11) NOT NULL,
  `quote_type` varchar(3) NOT NULL,
  `rfq_type` varchar(1) NOT NULL,
  `rev_sale_no` varchar(25) NOT NULL,
  `rfq_no` int(11) NOT NULL,
  `rank` int(11) NOT NULL,
  `start_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_date` date NOT NULL,
  `end_time` time NOT NULL,
  `currency` int(11) NOT NULL DEFAULT '0',
  `quote_by` int(11) NOT NULL,
  `show_l1_bid` varchar(1) NOT NULL DEFAULT 'N',
  `show_bidder_name` varchar(1) NOT NULL DEFAULT 'N',
  `part_bid_accepted` varchar(1) NOT NULL DEFAULT 'N',
  `show_competitor_name` varchar(1) NOT NULL DEFAULT 'N',
  `created_by` int(11) NOT NULL,
  `created_date` date NOT NULL,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rev_auc_bid_details`
--

CREATE TABLE `mm_rev_auc_bid_details` (
  `rev_auc_bid_id` int(11) NOT NULL,
  `rev_auc_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL DEFAULT '0',
  `supplier_id` int(11) NOT NULL,
  `lot_id` int(11) NOT NULL,
  `amount` decimal(12,3) NOT NULL,
  `bid_quantity` int(11) NOT NULL,
  `bid_unit` varchar(255) NOT NULL,
  `bid_date` date NOT NULL,
  `bid_time` time NOT NULL,
  `ip` varchar(20) NOT NULL DEFAULT 'NA',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rev_auc_lots`
--

CREATE TABLE `mm_rev_auc_lots` (
  `rev_lot_id` int(11) NOT NULL,
  `rev_auc_id` int(11) NOT NULL,
  `mat_code` varchar(255) NOT NULL,
  `mat_name` varchar(225) NOT NULL,
  `club_material` varchar(100) DEFAULT NULL,
  `description` text NOT NULL,
  `qty` int(11) NOT NULL,
  `bid_qty` int(11) NOT NULL,
  `unit` varchar(50) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `start_price` decimal(10,2) NOT NULL,
  `min_decr` int(11) NOT NULL,
  `plant` varchar(225) NOT NULL DEFAULT 'NA',
  `lot_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime(6) NOT NULL,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rev_auc_sup`
--

CREATE TABLE `mm_rev_auc_sup` (
  `rev_auc_sup_id` int(11) NOT NULL,
  `rev_auc_id` int(11) NOT NULL,
  `rev_auc_mat_id` int(11) NOT NULL,
  `lot_id` int(11) NOT NULL,
  `sup_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` date NOT NULL,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq`
--

CREATE TABLE `mm_rfq` (
  `rfq_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `quote_type` enum('RFQ','AUCTION') DEFAULT NULL,
  `rfq_type` enum('N','RC') NOT NULL,
  `rfq_number` varchar(35) NOT NULL,
  `price_breakup` varchar(10) NOT NULL COMMENT 'LM=lumsum, B=breakup',
  `price_basis` varchar(50) NOT NULL,
  `bid_type` varchar(10) NOT NULL,
  `emd` decimal(10,2) NOT NULL,
  `tax_id` varchar(100) DEFAULT NULL,
  `guarantee` varchar(50) NOT NULL,
  `period_supply` varchar(10) DEFAULT NULL,
  `project_code` varchar(11) NOT NULL,
  `start_date` date DEFAULT NULL,
  `start_time` time NOT NULL,
  `end_date` date DEFAULT NULL,
  `end_time` time NOT NULL,
  `lockquntildate` date NOT NULL,
  `lockquntiltime` time NOT NULL,
  `particulars` varchar(250) DEFAULT NULL,
  `terms_n_conditions_document` varchar(250) NOT NULL,
  `description` text,
  `document` varchar(250) DEFAULT NULL,
  `pr_id` varchar(255) NOT NULL,
  `material_id` int(11) NOT NULL DEFAULT '0',
  `collect_technical_bid` tinyint(1) NOT NULL DEFAULT '0',
  `collect_commercial_bid` tinyint(1) NOT NULL DEFAULT '0',
  `collect_rfq_response` tinyint(1) NOT NULL DEFAULT '0',
  `collect_other_document` tinyint(1) NOT NULL DEFAULT '0',
  `partial_acceptance_tc` tinyint(1) NOT NULL DEFAULT '0',
  `currency_id` int(11) DEFAULT '0',
  `rank` tinyint(1) NOT NULL DEFAULT '0',
  `rfq_status` enum('A','R','P','RE') NOT NULL DEFAULT 'P',
  `rfq_approved_by` int(11) NOT NULL DEFAULT '0',
  `rfq_approved_on` datetime DEFAULT NULL,
  `rfq_status_reason` varchar(255) NOT NULL DEFAULT '',
  `rfq_comment` varchar(255) NOT NULL DEFAULT '',
  `technical_mandatory` tinyint(1) DEFAULT NULL,
  `commercial_mandatory` tinyint(1) NOT NULL DEFAULT '0',
  `open_rfq` tinyint(1) NOT NULL,
  `bypass_technical_approval` tinyint(1) DEFAULT NULL,
  `negotiation` tinyint(1) DEFAULT NULL,
  `delivery_schedule` varchar(20) NOT NULL DEFAULT '',
  `payment_terms` varchar(20) NOT NULL DEFAULT '',
  `quantity` int(11) DEFAULT NULL,
  `supplier_id` int(11) NOT NULL,
  `convert_to_ra` tinyint(1) NOT NULL DEFAULT '0',
  `technical_approver` int(11) DEFAULT NULL,
  `commercial_approver` int(11) DEFAULT NULL,
  `includes_transportation` tinyint(1) NOT NULL DEFAULT '0',
  `other_taxes` varchar(11) DEFAULT NULL,
  `view_color` int(1) NOT NULL DEFAULT '0',
  `created_by` int(11) DEFAULT NULL,
  `created_on` datetime DEFAULT NULL,
  `updated_by` int(11) DEFAULT '0',
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_ans`
--

CREATE TABLE `mm_rfq_ans` (
  `rfq_comm_ans_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `mat_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `rfq_type_ans` text NOT NULL,
  `rfq_que_id` varchar(11) NOT NULL,
  `rfq_ans` varchar(250) NOT NULL,
  `bid_count` int(11) NOT NULL,
  `include_transpotation` varchar(250) NOT NULL,
  `other_taxes` varchar(250) NOT NULL,
  `rfq_approval_status` enum('P','A','R','RE') NOT NULL DEFAULT 'P' COMMENT 'P=pending,A= Approve,R = Reject,RE = Revise',
  `rfq_approval_by` int(11) DEFAULT NULL,
  `rfq_status_approve_date` datetime DEFAULT NULL,
  `comment` text,
  `comment_added_by` int(11) DEFAULT NULL,
  `comment_added_date` datetime DEFAULT NULL,
  `added_side` varchar(1) NOT NULL COMMENT 'S = Supplier, C = Company',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0',
  `rfq_comment` varchar(1000) DEFAULT NULL,
  `partially_check` int(11) NOT NULL,
  `fully_check` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_approvers`
--

CREATE TABLE `mm_rfq_approvers` (
  `auto_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL DEFAULT '0',
  `approver_emp_id` int(11) NOT NULL DEFAULT '0',
  `approval_status` varchar(1) NOT NULL,
  `approval_remark` varchar(255) NOT NULL,
  `cancel_flag` varchar(100) DEFAULT NULL,
  `level` int(11) DEFAULT NULL,
  `rfq_approvars_flag` varchar(1) NOT NULL DEFAULT 'N',
  `created_on` datetime NOT NULL,
  `updated_on` datetime NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `mm_rfq_file_upload`
--

CREATE TABLE `mm_rfq_file_upload` (
  `rfq_tech_ans_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL DEFAULT '0',
  `supplier_id` int(11) NOT NULL DEFAULT '0',
  `doc_files` varchar(250) NOT NULL,
  `document_type_name` varchar(250) NOT NULL,
  `bid_count` int(11) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_interested_supplier`
--

CREATE TABLE `mm_rfq_interested_supplier` (
  `rfq_int_sup_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_materials_data`
--

CREATE TABLE `mm_rfq_materials_data` (
  `rfq_mat_data_id` int(11) NOT NULL,
  `mm_material_id` int(11) NOT NULL DEFAULT '0',
  `rfq_pr_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `rfq_sup_id` int(11) NOT NULL,
  `rfq_mat_code` varchar(50) NOT NULL,
  `rfq_mat_name` varchar(255) NOT NULL,
  `rfq_mat_short_desc` text NOT NULL,
  `rfq_mat_long_desc` text NOT NULL,
  `rfq_qty` int(11) NOT NULL,
  `rfq_unit` varchar(50) NOT NULL,
  `rfq_unit_price` decimal(10,2) NOT NULL,
  `rfq_amt` decimal(10,0) NOT NULL,
  `rfq_startprice` int(11) NOT NULL,
  `rfq_min_dec` int(11) NOT NULL DEFAULT '0',
  `plant` varchar(255) NOT NULL DEFAULT 'NA',
  `discount` varchar(100) DEFAULT NULL,
  `discount_type` enum('OA','MW') DEFAULT NULL,
  `clubbed_material` varchar(10) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_old`
--

CREATE TABLE `mm_rfq_old` (
  `rfq_id` int(11) NOT NULL,
  `quote_type` enum('RFQ','AUCTION') NOT NULL,
  `rfq_type` enum('N','RC') NOT NULL,
  `rfq_number` varchar(35) NOT NULL,
  `price_basis` varchar(50) NOT NULL,
  `bid_type` varchar(10) NOT NULL,
  `emd` decimal(10,2) NOT NULL,
  `tax_id` varchar(255) NOT NULL,
  `guarantee` varchar(50) NOT NULL,
  `period_supply` varchar(10) DEFAULT NULL,
  `project_code` varchar(11) NOT NULL,
  `start_date` date DEFAULT NULL,
  `start_time` time NOT NULL,
  `end_date` date DEFAULT NULL,
  `end_time` time NOT NULL,
  `lockquntildate` date DEFAULT NULL,
  `lockquntiltime` time NOT NULL,
  `particulars` varchar(250) DEFAULT NULL,
  `terms_n_conditions_document` varchar(250) NOT NULL,
  `description` text,
  `document` varchar(250) DEFAULT NULL,
  `pr_id` varchar(255) NOT NULL,
  `material_id` int(11) NOT NULL DEFAULT '0',
  `collect_technical_bid` tinyint(1) NOT NULL DEFAULT '0',
  `collect_commercial_bid` tinyint(1) NOT NULL DEFAULT '0',
  `collect_rfq_response` tinyint(1) NOT NULL DEFAULT '0',
  `collect_other_document` tinyint(1) NOT NULL DEFAULT '0',
  `partial_acceptance_tc` tinyint(1) NOT NULL DEFAULT '0',
  `currency_id` int(11) DEFAULT '0',
  `rank` tinyint(1) NOT NULL DEFAULT '0',
  `rfq_status` enum('A','R','P','RE') NOT NULL DEFAULT 'P',
  `rfq_approved_by` int(11) NOT NULL DEFAULT '0',
  `rfq_approved_on` datetime DEFAULT NULL,
  `rfq_status_reason` varchar(255) NOT NULL DEFAULT '',
  `rfq_comment` varchar(255) NOT NULL DEFAULT '',
  `technical_mandatory` tinyint(1) DEFAULT NULL,
  `commercial_mandatory` tinyint(1) NOT NULL DEFAULT '0',
  `open_rfq` tinyint(1) NOT NULL,
  `bypass_technical_approval` tinyint(1) NOT NULL,
  `negotiation` tinyint(1) NOT NULL,
  `delivery_schedule` varchar(20) NOT NULL DEFAULT '',
  `payment_terms` varchar(20) NOT NULL DEFAULT '',
  `quantity` int(11) DEFAULT NULL,
  `company_id` int(11) NOT NULL DEFAULT '0',
  `supplier_id` int(11) NOT NULL,
  `convert_to_ra` tinyint(1) NOT NULL DEFAULT '0',
  `technical_approver` int(11) NOT NULL DEFAULT '0',
  `commercial_approver` int(11) NOT NULL DEFAULT '0',
  `includes_transportation` tinyint(1) NOT NULL DEFAULT '0',
  `other_taxes` varchar(11) DEFAULT NULL,
  `view_color` int(1) NOT NULL DEFAULT '0',
  `created_by` int(11) DEFAULT NULL,
  `created_on` datetime DEFAULT NULL,
  `updated_by` int(11) DEFAULT '0',
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_other_documents_data`
--

CREATE TABLE `mm_rfq_other_documents_data` (
  `mm_rfq_other_documents_data_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `document_name` varchar(255) NOT NULL,
  `document_path` varchar(255) NOT NULL,
  `mandatory` tinyint(1) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_pp_tax_amt`
--

CREATE TABLE `mm_rfq_pp_tax_amt` (
  `pp_tax_amt_id` int(11) NOT NULL,
  `pp_id` int(11) NOT NULL,
  `pp_tax_id` int(11) NOT NULL,
  `pp_tax_name` varchar(255) NOT NULL,
  `pp_tax_percent` varchar(255) NOT NULL,
  `pp_tax_amt` decimal(10,2) NOT NULL,
  `created_date` datetime NOT NULL,
  `created_by` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_pr_relation`
--

CREATE TABLE `mm_rfq_pr_relation` (
  `rfq_pr_relation_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `pr_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `created_on` datetime DEFAULT NULL,
  `updated_by` int(11) DEFAULT '0',
  `updated_on` datetime DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_purchase_proposal`
--

CREATE TABLE `mm_rfq_purchase_proposal` (
  `pp_id` int(11) NOT NULL,
  `pp_number` varchar(255) NOT NULL,
  `pp_rfq_id` int(11) NOT NULL,
  `pp_material_id` int(11) NOT NULL,
  `pp_unit_price` decimal(10,2) NOT NULL,
  `pp_amount` decimal(10,2) NOT NULL,
  `pp_period_of_supply` varchar(50) NOT NULL,
  `pp_delivery_schedule` varchar(50) NOT NULL,
  `pp_payment_terms` varchar(50) NOT NULL,
  `pp_supplier_id` int(11) NOT NULL,
  `pp_file_path` varchar(255) DEFAULT NULL,
  `approval_person_id` int(11) DEFAULT NULL,
  `pp_cmp_id` int(11) NOT NULL,
  `pp_approval_status` enum('P','A','R','RE') NOT NULL COMMENT '    P=pending,A= Approve,R = Reject,RE = Revise',
  `pp_approved_date` datetime DEFAULT NULL,
  `pp_approved_by` int(11) NOT NULL,
  `pp_remark` text NOT NULL,
  `pp_remark_added_date` datetime NOT NULL,
  `pp_remark_added_by` int(11) NOT NULL,
  `pp_created_by` int(11) NOT NULL,
  `pp_created_date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_purchase_proposal_materials`
--

CREATE TABLE `mm_rfq_purchase_proposal_materials` (
  `pp_auto_id` int(11) NOT NULL,
  `pp_id` int(11) NOT NULL,
  `pp_material_id` int(11) NOT NULL,
  `pp_material_name` varchar(255) NOT NULL,
  `pp_material_desc` text NOT NULL,
  `pp_material_qty` varchar(255) NOT NULL,
  `pp_material_unit` varchar(255) NOT NULL,
  `pp_material_unit_price` varchar(255) NOT NULL,
  `pp_material_amount` varchar(255) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_settings`
--

CREATE TABLE `mm_rfq_settings` (
  `mm_rfq_setting_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `open_rfq` tinyint(1) NOT NULL DEFAULT '0',
  `bypass_technical_approval` tinyint(1) NOT NULL DEFAULT '0',
  `partially_acceptance` tinyint(1) NOT NULL DEFAULT '0',
  `rank` tinyint(3) NOT NULL,
  `two_step_neg` tinyint(1) NOT NULL DEFAULT '0',
  `collect_technical_bid` tinyint(1) NOT NULL DEFAULT '0',
  `collect_commercial_bid` tinyint(1) NOT NULL DEFAULT '0',
  `collect_rfq_response` tinyint(1) NOT NULL DEFAULT '0',
  `collect_other_documents` tinyint(1) NOT NULL DEFAULT '0',
  `currency` varchar(10) NOT NULL,
  `commercial_approval_person` varchar(100) NOT NULL,
  `technical_approval_person` varchar(100) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_settings_docs`
--

CREATE TABLE `mm_rfq_settings_docs` (
  `mm_rfq_settings_docs_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `mm_rfq_setting_id` int(11) NOT NULL,
  `document_name` varchar(255) NOT NULL,
  `mandatory` tinyint(1) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_suppliers`
--

CREATE TABLE `mm_rfq_suppliers` (
  `rfq_sup_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `supplier_id` int(11) NOT NULL,
  `material_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_sup_mats`
--

CREATE TABLE `mm_rfq_sup_mats` (
  `rfq_mat_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL,
  `rfq_mat_data_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `lot_no` int(11) NOT NULL,
  `club_materials` varchar(100) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `qty` int(11) NOT NULL DEFAULT '0',
  `other_specification` varchar(255) NOT NULL,
  `price` int(11) NOT NULL DEFAULT '0',
  `discount` varchar(100) DEFAULT NULL,
  `discount_type` enum('OA','MW') DEFAULT NULL,
  `add_charges` int(11) NOT NULL DEFAULT '0',
  `add_charger_desc` text,
  `total_value` int(11) NOT NULL DEFAULT '0',
  `cmp_sts` enum('P','A','R','RE','N') NOT NULL DEFAULT 'P',
  `cmp_sts_added_by` int(11) DEFAULT NULL,
  `cmp_sts_added_date` datetime DEFAULT NULL,
  `cmp_comment` text,
  `cmp_comment_added_by` int(11) DEFAULT NULL,
  `cmp_comment_added_date` datetime DEFAULT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rfq_t_c`
--

CREATE TABLE `mm_rfq_t_c` (
  `t_c_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL DEFAULT '0',
  `bidder_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `term_accept` enum('0','1') NOT NULL DEFAULT '0',
  `show_interest` enum('0','1') NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_date` datetime NOT NULL,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_rolewise_emp_permissions`
--

CREATE TABLE `mm_rolewise_emp_permissions` (
  `rolewise_emp_permission_id` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `employee_id` varchar(100) NOT NULL,
  `employee_name` varchar(100) NOT NULL,
  `module_id` int(11) NOT NULL,
  `sub_module_id` int(11) NOT NULL,
  `permission_id` varchar(11) NOT NULL,
  `page_permission_id` int(11) DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_send_grn_log`
--

CREATE TABLE `mm_send_grn_log` (
  `send_grn_id` int(11) NOT NULL,
  `grn_id` int(11) NOT NULL,
  `supplier_id` int(11) NOT NULL,
  `send_by` int(11) NOT NULL,
  `send_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `company_id` int(11) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_states`
--

CREATE TABLE `mm_states` (
  `id` int(11) NOT NULL,
  `state_name` varchar(255) NOT NULL,
  `created_date` datetime DEFAULT CURRENT_TIMESTAMP,
  `created_by` text,
  `updated_date` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
  `updated_by` text,
  `is_delete` tinyint(4) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_subdivision_budget`
--

CREATE TABLE `mm_subdivision_budget` (
  `mm_sub_division_budget_id` int(11) NOT NULL,
  `plant_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `division_id` int(11) NOT NULL,
  `sub_division_id` int(11) NOT NULL,
  `budget` decimal(10,2) NOT NULL,
  `division_budget` decimal(10,2) NOT NULL,
  `available_budget` decimal(10,2) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `created_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `is_delete` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_sub_division`
--

CREATE TABLE `mm_sub_division` (
  `sub_division_id` int(11) NOT NULL,
  `plant_id` int(11) NOT NULL,
  `plant_code` varchar(100) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `division_code` varchar(100) NOT NULL,
  `division_id` int(11) NOT NULL,
  `sub_division_code` varchar(100) NOT NULL,
  `sub_division_name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_supplier_material_group`
--

CREATE TABLE `mm_supplier_material_group` (
  `sup_mat_group_id` int(11) NOT NULL,
  `supplier_id` varchar(100) NOT NULL,
  `material_id` varchar(100) NOT NULL,
  `material_code` varchar(100) NOT NULL,
  `material_name` varchar(155) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL,
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_taxes`
--

CREATE TABLE `mm_taxes` (
  `tax_id` int(11) NOT NULL,
  `cmp_id` int(11) NOT NULL,
  `tax_name` varchar(255) NOT NULL,
  `tax_code` varchar(100) NOT NULL,
  `short_description` text NOT NULL,
  `long_description` text NOT NULL,
  `inr_type` enum('inr','percent') DEFAULT NULL,
  `inr` varchar(255) NOT NULL,
  `tax_type` enum('direct','indirect') DEFAULT NULL,
  `hsn_code` varchar(100) NOT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'inactive' COMMENT 'P=Pending, A=Approved, R=Reject',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `mm_technical_questions`
--

CREATE TABLE `mm_technical_questions` (
  `rfq_technical_id` int(11) NOT NULL,
  `rfq_id` int(11) NOT NULL DEFAULT '0',
  `cmp_id` int(11) DEFAULT NULL,
  `material_id` int(11) NOT NULL DEFAULT '0',
  `rfq_technical_question` varchar(255) NOT NULL,
  `rfq_technical_question_mandatory` tinyint(4) NOT NULL DEFAULT '0',
  `created_by` int(11) NOT NULL DEFAULT '0',
  `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_by` int(11) NOT NULL DEFAULT '0',
  `updated_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_delete` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `p2p_system_log`
--

CREATE TABLE `p2p_system_log` (
  `logid` int(11) NOT NULL,
  `employee_id` int(11) DEFAULT NULL,
  `designation` int(11) DEFAULT NULL,
  `department` int(11) DEFAULT NULL,
  `module` varchar(255) DEFAULT NULL,
  `ip` varchar(20) NOT NULL,
  `updated_by` varchar(50) NOT NULL,
  `log_title` varchar(200) NOT NULL,
  `table_affected` varchar(100) NOT NULL,
  `reference_id` int(11) NOT NULL,
  `from_data` longtext,
  `to_data` longtext,
  `operation` enum('Add','Edit','Delete') NOT NULL,
  `date_updated` datetime DEFAULT CURRENT_TIMESTAMP,
  `transaction_done_by` int(11) NOT NULL,
  `cmp_id` int(11) DEFAULT NULL,
  `is_delete` int(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `system_settings`
--

CREATE TABLE `system_settings` (
  `auto_id` int(11) NOT NULL,
  `auto_manual` varchar(1) NOT NULL DEFAULT 'M',
  `suffix` varchar(20) NOT NULL,
  `prefix` varchar(20) NOT NULL,
  `separator_str` varchar(1) NOT NULL,
  `dept_code` varchar(1) NOT NULL DEFAULT 'Y',
  `settings_for` varchar(5) NOT NULL,
  `setting_str` varchar(200) NOT NULL,
  `updated_by` int(11) NOT NULL,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `userloginlog`
--

CREATE TABLE `userloginlog` (
  `log_id` int(11) NOT NULL,
  `sup_id` int(11) NOT NULL,
  `login_dt` date NOT NULL,
  `logout_dt` date NOT NULL,
  `login_time` time NOT NULL,
  `logout_time` time NOT NULL,
  `ip` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `mm_commercial_questions`
--
ALTER TABLE `mm_commercial_questions`
  ADD PRIMARY KEY (`rfq_commercial_id`);

--
-- Indexes for table `mm_company`
--
ALTER TABLE `mm_company`
  ADD PRIMARY KEY (`company_id`);

--
-- Indexes for table `mm_company_budget`
--
ALTER TABLE `mm_company_budget`
  ADD PRIMARY KEY (`company_budget_id`),
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_department`
--
ALTER TABLE `mm_department`
  ADD PRIMARY KEY (`department_id`);

--
-- Indexes for table `mm_division`
--
ALTER TABLE `mm_division`
  ADD PRIMARY KEY (`division_id`);

--
-- Indexes for table `mm_division_budget`
--
ALTER TABLE `mm_division_budget`
  ADD PRIMARY KEY (`mm_division_budget_id`),
  ADD KEY `division_id` (`division_id`),
  ADD KEY `cmp_id` (`cmp_id`),
  ADD KEY `plant_id` (`plant_id`);

--
-- Indexes for table `mm_employee_permissions`
--
ALTER TABLE `mm_employee_permissions`
  ADD PRIMARY KEY (`employee_permission_id`);

--
-- Indexes for table `mm_financial_document`
--
ALTER TABLE `mm_financial_document`
  ADD PRIMARY KEY (`financial_document_id`);

--
-- Indexes for table `mm_financial_document_approvals`
--
ALTER TABLE `mm_financial_document_approvals`
  ADD PRIMARY KEY (`financial_document_approval_id`);

--
-- Indexes for table `mm_financial_document_materials`
--
ALTER TABLE `mm_financial_document_materials`
  ADD PRIMARY KEY (`financial_document_material_id`);

--
-- Indexes for table `mm_grn`
--
ALTER TABLE `mm_grn`
  ADD PRIMARY KEY (`grn_id`),
  ADD UNIQUE KEY `uc_bill_no` (`bill_no`),
  ADD KEY `grn_no` (`grn_no`),
  ADD KEY `suppplier_id` (`supplier_id`),
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_grn_approved`
--
ALTER TABLE `mm_grn_approved`
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_grn_inspected_materials`
--
ALTER TABLE `mm_grn_inspected_materials`
  ADD PRIMARY KEY (`inspected_mat_id`),
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_grn_inspection`
--
ALTER TABLE `mm_grn_inspection`
  ADD PRIMARY KEY (`inspection_id`),
  ADD KEY `grn_id` (`grn_id`),
  ADD KEY `supplier_id` (`supplier_id`),
  ADD KEY `po_id_2` (`po_id`),
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_grn_materials`
--
ALTER TABLE `mm_grn_materials`
  ADD PRIMARY KEY (`grn_mat_id`),
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_grn_sended`
--
ALTER TABLE `mm_grn_sended`
  ADD PRIMARY KEY (`grn_sended_id`),
  ADD KEY `grn_id` (`grn_id`),
  ADD KEY `cmp_id` (`cmp_id`);

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

--
-- Indexes for table `mm_inventory_grn`
--
ALTER TABLE `mm_inventory_grn`
  ADD PRIMARY KEY (`grn_id`),
  ADD UNIQUE KEY `uc_bill_no` (`bill_no`),
  ADD KEY `grn_no` (`grn_no`),
  ADD KEY `material_id` (`material_id`);

--
-- Indexes for table `mm_invoice`
--
ALTER TABLE `mm_invoice`
  ADD PRIMARY KEY (`invoice_id`);

--
-- Indexes for table `mm_invoices`
--
ALTER TABLE `mm_invoices`
  ADD PRIMARY KEY (`invoice_id`);

--
-- Indexes for table `mm_invoices_approval`
--
ALTER TABLE `mm_invoices_approval`
  ADD PRIMARY KEY (`approved_id`);

--
-- Indexes for table `mm_invoices_company_approvals`
--
ALTER TABLE `mm_invoices_company_approvals`
  ADD PRIMARY KEY (`mm_invoices_company_approvals_id`);

--
-- Indexes for table `mm_invoices_materials`
--
ALTER TABLE `mm_invoices_materials`
  ADD PRIMARY KEY (`mm_invoice_material_id`);

--
-- Indexes for table `mm_invoices_taxes`
--
ALTER TABLE `mm_invoices_taxes`
  ADD PRIMARY KEY (`mm_invoices_taxes_id`);

--
-- Indexes for table `mm_invoice_closed`
--
ALTER TABLE `mm_invoice_closed`
  ADD PRIMARY KEY (`invoice_closed_id`);

--
-- Indexes for table `mm_materials`
--
ALTER TABLE `mm_materials`
  ADD PRIMARY KEY (`material_id`);

--
-- Indexes for table `mm_material_consumed`
--
ALTER TABLE `mm_material_consumed`
  ADD PRIMARY KEY (`mm_material_consumed_id`);

--
-- Indexes for table `mm_material_plant`
--
ALTER TABLE `mm_material_plant`
  ADD PRIMARY KEY (`mm_material_plant_id`),
  ADD KEY `mm_material_id` (`mm_material_id`) USING BTREE;

--
-- Indexes for table `mm_material_unit`
--
ALTER TABLE `mm_material_unit`
  ADD PRIMARY KEY (`mm_material_unit_id`),
  ADD KEY `mm_material_id` (`mm_material_id`) USING BTREE;

--
-- Indexes for table `mm_page_permissions`
--
ALTER TABLE `mm_page_permissions`
  ADD PRIMARY KEY (`mm_page_permissions_id`);

--
-- Indexes for table `mm_payments_terms`
--
ALTER TABLE `mm_payments_terms`
  ADD PRIMARY KEY (`payment_terms_id`);

--
-- Indexes for table `mm_permissions`
--
ALTER TABLE `mm_permissions`
  ADD PRIMARY KEY (`permission_id`);

--
-- Indexes for table `mm_permission_module`
--
ALTER TABLE `mm_permission_module`
  ADD PRIMARY KEY (`permission_module_id`);

--
-- Indexes for table `mm_permission_submodule`
--
ALTER TABLE `mm_permission_submodule`
  ADD PRIMARY KEY (`permission_sub_module_id`);

--
-- Indexes for table `mm_plants`
--
ALTER TABLE `mm_plants`
  ADD PRIMARY KEY (`plant_id`);

--
-- Indexes for table `mm_plant_budget`
--
ALTER TABLE `mm_plant_budget`
  ADD PRIMARY KEY (`plant_budget_id`),
  ADD KEY `cmp_id` (`cmp_id`),
  ADD KEY `plant_id` (`plant_id`);

--
-- Indexes for table `mm_po_invoice`
--
ALTER TABLE `mm_po_invoice`
  ADD PRIMARY KEY (`po_invoice_id`);

--
-- Indexes for table `mm_po_invoice_approvals`
--
ALTER TABLE `mm_po_invoice_approvals`
  ADD PRIMARY KEY (`invoice_approval_id`);

--
-- Indexes for table `mm_po_masters`
--
ALTER TABLE `mm_po_masters`
  ADD PRIMARY KEY (`po_id`);

--
-- Indexes for table `mm_po_materials`
--
ALTER TABLE `mm_po_materials`
  ADD PRIMARY KEY (`po_material_id`);

--
-- Indexes for table `mm_po_supplier_suggestion`
--
ALTER TABLE `mm_po_supplier_suggestion`
  ADD PRIMARY KEY (`po_supplier_suggestion_id`);

--
-- Indexes for table `mm_price_basis`
--
ALTER TABLE `mm_price_basis`
  ADD PRIMARY KEY (`price_basis_id`);

--
-- Indexes for table `mm_pr_allocated`
--
ALTER TABLE `mm_pr_allocated`
  ADD PRIMARY KEY (`pr_allocated_id`);

--
-- Indexes for table `mm_pr_approvals`
--
ALTER TABLE `mm_pr_approvals`
  ADD PRIMARY KEY (`pr_approval_id`);

--
-- Indexes for table `mm_pr_master`
--
ALTER TABLE `mm_pr_master`
  ADD PRIMARY KEY (`pr_id`);

--
-- Indexes for table `mm_pr_materials`
--
ALTER TABLE `mm_pr_materials`
  ADD PRIMARY KEY (`pr_material_id`);

--
-- Indexes for table `mm_pr_supplier_suggestion`
--
ALTER TABLE `mm_pr_supplier_suggestion`
  ADD PRIMARY KEY (`supplier_suggestion_id`);

--
-- Indexes for table `mm_reverse_auction`
--
ALTER TABLE `mm_reverse_auction`
  ADD PRIMARY KEY (`rev_auc_id`);

--
-- Indexes for table `mm_rev_auc_lots`
--
ALTER TABLE `mm_rev_auc_lots`
  ADD PRIMARY KEY (`rev_lot_id`);

--
-- Indexes for table `mm_rfq`
--
ALTER TABLE `mm_rfq`
  ADD PRIMARY KEY (`rfq_id`),
  ADD KEY `supplier_id` (`supplier_id`),
  ADD KEY `pr_id` (`pr_id`);

--
-- Indexes for table `mm_rfq_ans`
--
ALTER TABLE `mm_rfq_ans`
  ADD PRIMARY KEY (`rfq_comm_ans_id`);

--
-- Indexes for table `mm_rfq_materials_data`
--
ALTER TABLE `mm_rfq_materials_data`
  ADD PRIMARY KEY (`rfq_mat_data_id`),
  ADD KEY `rfq_pr_id` (`rfq_pr_id`),
  ADD KEY `rfq_id` (`rfq_id`),
  ADD KEY `rfq_sup_id` (`rfq_sup_id`),
  ADD KEY `rfq_mat_code` (`rfq_mat_code`);

--
-- Indexes for table `mm_rfq_old`
--
ALTER TABLE `mm_rfq_old`
  ADD PRIMARY KEY (`rfq_id`),
  ADD KEY `supplier_id` (`supplier_id`),
  ADD KEY `pr_id` (`pr_id`);

--
-- Indexes for table `mm_rfq_other_documents_data`
--
ALTER TABLE `mm_rfq_other_documents_data`
  ADD PRIMARY KEY (`mm_rfq_other_documents_data_id`);

--
-- Indexes for table `mm_rfq_pp_tax_amt`
--
ALTER TABLE `mm_rfq_pp_tax_amt`
  ADD PRIMARY KEY (`pp_tax_amt_id`);

--
-- Indexes for table `mm_rfq_pr_relation`
--
ALTER TABLE `mm_rfq_pr_relation`
  ADD PRIMARY KEY (`rfq_pr_relation_id`);

--
-- Indexes for table `mm_rfq_purchase_proposal`
--
ALTER TABLE `mm_rfq_purchase_proposal`
  ADD PRIMARY KEY (`pp_id`);

--
-- Indexes for table `mm_rfq_purchase_proposal_materials`
--
ALTER TABLE `mm_rfq_purchase_proposal_materials`
  ADD PRIMARY KEY (`pp_auto_id`);

--
-- Indexes for table `mm_rfq_settings`
--
ALTER TABLE `mm_rfq_settings`
  ADD PRIMARY KEY (`mm_rfq_setting_id`);

--
-- Indexes for table `mm_rfq_settings_docs`
--
ALTER TABLE `mm_rfq_settings_docs`
  ADD PRIMARY KEY (`mm_rfq_settings_docs_id`),
  ADD KEY `cmp_id` (`cmp_id`);

--
-- Indexes for table `mm_rfq_suppliers`
--
ALTER TABLE `mm_rfq_suppliers`
  ADD PRIMARY KEY (`rfq_sup_id`);

--
-- Indexes for table `mm_rfq_sup_mats`
--
ALTER TABLE `mm_rfq_sup_mats`
  ADD PRIMARY KEY (`rfq_mat_id`);

--
-- Indexes for table `mm_rfq_t_c`
--
ALTER TABLE `mm_rfq_t_c`
  ADD PRIMARY KEY (`t_c_id`),
  ADD KEY `rfq_id` (`rfq_id`);

--
-- Indexes for table `mm_rolewise_emp_permissions`
--
ALTER TABLE `mm_rolewise_emp_permissions`
  ADD PRIMARY KEY (`rolewise_emp_permission_id`);

--
-- Indexes for table `mm_send_grn_log`
--
ALTER TABLE `mm_send_grn_log`
  ADD PRIMARY KEY (`send_grn_id`);

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

--
-- Indexes for table `mm_subdivision_budget`
--
ALTER TABLE `mm_subdivision_budget`
  ADD PRIMARY KEY (`mm_sub_division_budget_id`),
  ADD KEY `plant_id` (`plant_id`),
  ADD KEY `cmp_id` (`cmp_id`),
  ADD KEY `division_id` (`division_id`),
  ADD KEY `sub_division_id` (`sub_division_id`);

--
-- Indexes for table `mm_sub_division`
--
ALTER TABLE `mm_sub_division`
  ADD PRIMARY KEY (`sub_division_id`);

--
-- Indexes for table `mm_supplier_material_group`
--
ALTER TABLE `mm_supplier_material_group`
  ADD PRIMARY KEY (`sup_mat_group_id`);

--
-- Indexes for table `mm_taxes`
--
ALTER TABLE `mm_taxes`
  ADD PRIMARY KEY (`tax_id`);

--
-- Indexes for table `mm_technical_questions`
--
ALTER TABLE `mm_technical_questions`
  ADD PRIMARY KEY (`rfq_technical_id`),
  ADD KEY `rfq_id` (`rfq_id`);

--
-- Indexes for table `p2p_system_log`
--
ALTER TABLE `p2p_system_log`
  ADD PRIMARY KEY (`logid`);

--
-- Indexes for table `system_settings`
--
ALTER TABLE `system_settings`
  ADD PRIMARY KEY (`auto_id`);

--
-- Indexes for table `userloginlog`
--
ALTER TABLE `userloginlog`
  ADD PRIMARY KEY (`log_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `mm_commercial_questions`
--
ALTER TABLE `mm_commercial_questions`
  MODIFY `rfq_commercial_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_company`
--
ALTER TABLE `mm_company`
  MODIFY `company_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `mm_company_budget`
--
ALTER TABLE `mm_company_budget`
  MODIFY `company_budget_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_department`
--
ALTER TABLE `mm_department`
  MODIFY `department_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_division`
--
ALTER TABLE `mm_division`
  MODIFY `division_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_division_budget`
--
ALTER TABLE `mm_division_budget`
  MODIFY `mm_division_budget_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_employee_permissions`
--
ALTER TABLE `mm_employee_permissions`
  MODIFY `employee_permission_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_financial_document`
--
ALTER TABLE `mm_financial_document`
  MODIFY `financial_document_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_financial_document_approvals`
--
ALTER TABLE `mm_financial_document_approvals`
  MODIFY `financial_document_approval_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_financial_document_materials`
--
ALTER TABLE `mm_financial_document_materials`
  MODIFY `financial_document_material_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_grn`
--
ALTER TABLE `mm_grn`
  MODIFY `grn_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_grn_inspected_materials`
--
ALTER TABLE `mm_grn_inspected_materials`
  MODIFY `inspected_mat_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_grn_inspection`
--
ALTER TABLE `mm_grn_inspection`
  MODIFY `inspection_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_grn_materials`
--
ALTER TABLE `mm_grn_materials`
  MODIFY `grn_mat_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_grn_sended`
--
ALTER TABLE `mm_grn_sended`
  MODIFY `grn_sended_id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `mm_inventory_grn`
--
ALTER TABLE `mm_inventory_grn`
  MODIFY `grn_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoice`
--
ALTER TABLE `mm_invoice`
  MODIFY `invoice_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoices`
--
ALTER TABLE `mm_invoices`
  MODIFY `invoice_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoices_approval`
--
ALTER TABLE `mm_invoices_approval`
  MODIFY `approved_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoices_company_approvals`
--
ALTER TABLE `mm_invoices_company_approvals`
  MODIFY `mm_invoices_company_approvals_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoices_materials`
--
ALTER TABLE `mm_invoices_materials`
  MODIFY `mm_invoice_material_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoices_taxes`
--
ALTER TABLE `mm_invoices_taxes`
  MODIFY `mm_invoices_taxes_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_invoice_closed`
--
ALTER TABLE `mm_invoice_closed`
  MODIFY `invoice_closed_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_materials`
--
ALTER TABLE `mm_materials`
  MODIFY `material_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_material_consumed`
--
ALTER TABLE `mm_material_consumed`
  MODIFY `mm_material_consumed_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_material_plant`
--
ALTER TABLE `mm_material_plant`
  MODIFY `mm_material_plant_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_material_unit`
--
ALTER TABLE `mm_material_unit`
  MODIFY `mm_material_unit_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_page_permissions`
--
ALTER TABLE `mm_page_permissions`
  MODIFY `mm_page_permissions_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_payments_terms`
--
ALTER TABLE `mm_payments_terms`
  MODIFY `payment_terms_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_permissions`
--
ALTER TABLE `mm_permissions`
  MODIFY `permission_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_permission_module`
--
ALTER TABLE `mm_permission_module`
  MODIFY `permission_module_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_permission_submodule`
--
ALTER TABLE `mm_permission_submodule`
  MODIFY `permission_sub_module_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_plants`
--
ALTER TABLE `mm_plants`
  MODIFY `plant_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_plant_budget`
--
ALTER TABLE `mm_plant_budget`
  MODIFY `plant_budget_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_po_invoice`
--
ALTER TABLE `mm_po_invoice`
  MODIFY `po_invoice_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_po_invoice_approvals`
--
ALTER TABLE `mm_po_invoice_approvals`
  MODIFY `invoice_approval_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_po_masters`
--
ALTER TABLE `mm_po_masters`
  MODIFY `po_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_po_materials`
--
ALTER TABLE `mm_po_materials`
  MODIFY `po_material_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_po_supplier_suggestion`
--
ALTER TABLE `mm_po_supplier_suggestion`
  MODIFY `po_supplier_suggestion_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_price_basis`
--
ALTER TABLE `mm_price_basis`
  MODIFY `price_basis_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_pr_allocated`
--
ALTER TABLE `mm_pr_allocated`
  MODIFY `pr_allocated_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_pr_approvals`
--
ALTER TABLE `mm_pr_approvals`
  MODIFY `pr_approval_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_pr_master`
--
ALTER TABLE `mm_pr_master`
  MODIFY `pr_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_pr_materials`
--
ALTER TABLE `mm_pr_materials`
  MODIFY `pr_material_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_pr_supplier_suggestion`
--
ALTER TABLE `mm_pr_supplier_suggestion`
  MODIFY `supplier_suggestion_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_reverse_auction`
--
ALTER TABLE `mm_reverse_auction`
  MODIFY `rev_auc_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rev_auc_lots`
--
ALTER TABLE `mm_rev_auc_lots`
  MODIFY `rev_lot_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq`
--
ALTER TABLE `mm_rfq`
  MODIFY `rfq_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_ans`
--
ALTER TABLE `mm_rfq_ans`
  MODIFY `rfq_comm_ans_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_materials_data`
--
ALTER TABLE `mm_rfq_materials_data`
  MODIFY `rfq_mat_data_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_old`
--
ALTER TABLE `mm_rfq_old`
  MODIFY `rfq_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_other_documents_data`
--
ALTER TABLE `mm_rfq_other_documents_data`
  MODIFY `mm_rfq_other_documents_data_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_pp_tax_amt`
--
ALTER TABLE `mm_rfq_pp_tax_amt`
  MODIFY `pp_tax_amt_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_pr_relation`
--
ALTER TABLE `mm_rfq_pr_relation`
  MODIFY `rfq_pr_relation_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_purchase_proposal`
--
ALTER TABLE `mm_rfq_purchase_proposal`
  MODIFY `pp_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_purchase_proposal_materials`
--
ALTER TABLE `mm_rfq_purchase_proposal_materials`
  MODIFY `pp_auto_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_settings`
--
ALTER TABLE `mm_rfq_settings`
  MODIFY `mm_rfq_setting_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_settings_docs`
--
ALTER TABLE `mm_rfq_settings_docs`
  MODIFY `mm_rfq_settings_docs_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_suppliers`
--
ALTER TABLE `mm_rfq_suppliers`
  MODIFY `rfq_sup_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_sup_mats`
--
ALTER TABLE `mm_rfq_sup_mats`
  MODIFY `rfq_mat_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rfq_t_c`
--
ALTER TABLE `mm_rfq_t_c`
  MODIFY `t_c_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_rolewise_emp_permissions`
--
ALTER TABLE `mm_rolewise_emp_permissions`
  MODIFY `rolewise_emp_permission_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_send_grn_log`
--
ALTER TABLE `mm_send_grn_log`
  MODIFY `send_grn_id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- AUTO_INCREMENT for table `mm_subdivision_budget`
--
ALTER TABLE `mm_subdivision_budget`
  MODIFY `mm_sub_division_budget_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_sub_division`
--
ALTER TABLE `mm_sub_division`
  MODIFY `sub_division_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_supplier_material_group`
--
ALTER TABLE `mm_supplier_material_group`
  MODIFY `sup_mat_group_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_taxes`
--
ALTER TABLE `mm_taxes`
  MODIFY `tax_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `mm_technical_questions`
--
ALTER TABLE `mm_technical_questions`
  MODIFY `rfq_technical_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `p2p_system_log`
--
ALTER TABLE `p2p_system_log`
  MODIFY `logid` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `system_settings`
--
ALTER TABLE `system_settings`
  MODIFY `auto_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `userloginlog`
--
ALTER TABLE `userloginlog`
  MODIFY `log_id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

