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

START TRANSACTION;



--
-- Database: `mylikita_2022`
--

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

--
-- Table structure for table `branches`
--

CREATE TABLE `branches` (
  `id` int(11) NOT NULL,
  `branch_name` varchar(50) DEFAULT NULL,
  `state` varchar(50) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  `created_time` timestamp NULL DEFAULT NULL,
  `facilityId` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `pharm_store`
--

CREATE TABLE `pharm_store` (
  `balance` int(11) DEFAULT 0,
  `drug_name` varchar(100) CHARACTER SET latin1 NOT NULL,
  `price` float NOT NULL,
  `prefix` varchar(50) DEFAULT NULL,
  `item_code` varchar(50) NOT NULL,
  `group_code` varchar(50) DEFAULT NULL,
  `specification` varchar(50) DEFAULT NULL,
  `facilityId` varchar(50) CHARACTER SET latin1 NOT NULL,
  `expired_status` varchar(50) NOT NULL DEFAULT 'false',
  `expiry_date` date NOT NULL DEFAULT '1111-11-11',
  `store` varchar(50) NOT NULL,
  `selling_price` float NOT NULL,
  `supplier_name` varchar(100) NOT NULL,
  `supplier_code` varchar(100) NOT NULL,
  `store_location` varchar(50) NOT NULL,
  `generic_name` varchar(50) NOT NULL,
  `insert_date` datetime NOT NULL,
  `reoder_level` int(50) DEFAULT NULL,
  `uom` varchar(100) DEFAULT NULL,
  `drug_category` varchar(100) DEFAULT NULL,
  `item_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `pharm_store`
--

INSERT INTO `pharm_store` (`balance`, `drug_name`, `price`, `prefix`, `item_code`, `group_code`, `specification`, `facilityId`, `expired_status`, `expiry_date`, `store`, `selling_price`, `supplier_name`, `supplier_code`, `store_location`, `generic_name`, `insert_date`, `reoder_level`, `uom`, `drug_category`, `item_id`) VALUES
(998, 'Amozine', 100, NULL, 'e5e33ece-3e59-4d68-9a60-07630c3fafe1', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '2024-12-31', 'Fahad Store', 1000, 'Fahad Ado Muhammad', '7ecc0624-7667-4366-a81c-6f09ad8f5750', '', 'FRUSEMIDE 40MG', '2022-07-07 10:15:19', 1000, 'unit', 'Pandano', 9),
(80, 'Angolin', 100, NULL, '4bb1cb89-29a8-43f5-8c6c-9b032c1ab97e', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '2022-05-18', 'Fahad Store', 200, 'Fahad Ado Muhammad', 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', '', 'Good', '2022-05-16 14:24:55', 10, 'unit', 'Pandano', 7),
(998, 'Angolin', 1000, NULL, 'd8bd1ed8-e357-43e1-8b05-ec576fd21852', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '2022-12-31', 'Fahad Store', 1000, 'Fahad Ado Muhammad', 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', '', 'Good', '2022-05-16 14:24:55', 1000, 'unit', 'Pandano', 6),
(999, 'Anpasolin', 1000, NULL, '486e769c-061a-4e7f-ace4-4217d2849d3a', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '2022-05-31', 'Fahad Store', 1000, 'Fahad Ado Muhammad', '2895b0b8-f1b1-4b11-9339-b0665d08df33', '', 'Good', '2022-05-16 14:03:35', 1000, 'unit', 'Pandano', 5),
(1000, 'Panadoline', 1000, NULL, '78fc938e-939d-461a-9d31-7665ba923e70', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '1111-11-11', 'Fahad Store', 1000, 'Fahad Ado Muhammad', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', '', 'Good', '2022-04-23 13:42:03', 1000, 'unit', 'Pandano', 4),
(2000, 'Panadoline', 1000, NULL, '78fc938e-939d-461a-9d31-7665ba923e70', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '2022-08-31', 'Fahad Store', 1000, 'Fahad Ado Muhammad', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', '', 'Paracetamol', '2022-04-23 13:40:49', 1000, 'unit', 'Pandano', 3),
(91, 'Pandol', 1000, NULL, 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, NULL, '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 'false', '2022-12-31', 'Fahad Store', 1900, 'Fahad Ado Muhammad', 'f0e15c5c-31b2-4ee0-aba9-ae383403602a', '', 'Paracetamol', '2022-05-17 14:42:32', 10, 'unit', 'Pandano', 8);

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

--
-- Table structure for table `pharm_store_entries`
--

CREATE TABLE `pharm_store_entries` (
  `version_id` varchar(100) DEFAULT NULL,
  `receive_date` varchar(50) DEFAULT NULL,
  `drug_name` varchar(50) DEFAULT NULL,
  `id` int(11) NOT NULL,
  `po_no` varchar(50) DEFAULT NULL,
  `qty_in` varchar(50) DEFAULT NULL,
  `qty_out` varchar(50) DEFAULT NULL,
  `store_type` varchar(20) DEFAULT 'Local',
  `item_code` varchar(50) DEFAULT NULL,
  `barcode` varchar(50) DEFAULT NULL,
  `grn_no` varchar(50) DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `unit_price` float NOT NULL DEFAULT 0,
  `cost_price` float DEFAULT NULL,
  `mark_up` varchar(50) DEFAULT NULL,
  `selling_price` varchar(100) DEFAULT NULL,
  `transfer_from` varchar(50) DEFAULT NULL,
  `transfer_to` varchar(50) DEFAULT NULL,
  `branch_name` varchar(50) DEFAULT NULL,
  `item_status` varchar(20) DEFAULT NULL,
  `inserted_time` datetime(6) DEFAULT NULL,
  `inserted_by` varchar(50) DEFAULT NULL,
  `facilityId` varchar(50) DEFAULT NULL,
  `trn_number` varchar(50) DEFAULT NULL,
  `uniqueId` varchar(40) DEFAULT NULL,
  `drug_category` varchar(100) DEFAULT 'Local',
  `truckNo` varchar(50) DEFAULT NULL,
  `waybillNo` varchar(50) DEFAULT NULL,
  `otherInfo` varchar(100) DEFAULT NULL,
  `supplier_code` varchar(150) DEFAULT NULL,
  `supplier_name` varchar(200) DEFAULT NULL,
  `reorder_level` int(11) DEFAULT NULL,
  `sales_type` varchar(50) NOT NULL,
  `userName` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `pharm_store_entries`
--

INSERT INTO `pharm_store_entries` (`version_id`, `receive_date`, `drug_name`, `id`, `po_no`, `qty_in`, `qty_out`, `store_type`, `item_code`, `barcode`, `grn_no`, `expiry_date`, `unit_price`, `cost_price`, `mark_up`, `selling_price`, `transfer_from`, `transfer_to`, `branch_name`, `item_status`, `inserted_time`, `inserted_by`, `facilityId`, `trn_number`, `uniqueId`, `drug_category`, `truckNo`, `waybillNo`, `otherInfo`, `supplier_code`, `supplier_name`, `reorder_level`, `sales_type`, `userName`) VALUES
('1650535903043', '2022-04-21 10:11:43', '10CC SYRINGE ', 1, NULL, '0', '10', 'Local', '1644', NULL, '', '2025-01-30', 0, NULL, NULL, '70', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 10:11:43.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650536333214', '2022-04-21 10:18:53', '23G DISPOSABLE NEEDLE ', 2, NULL, '0', '2', 'Local', '2663', NULL, '', '2026-06-27', 0, NULL, NULL, '20', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 10:18:53.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650536333217', '2022-04-21 10:18:53', '30 DAYS BEAUTY SECRET ', 3, NULL, '0', '1', 'Local', '3213', NULL, '', '2023-09-28', 0, NULL, NULL, '18400', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 10:18:53.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650536386582', '2022-04-21 10:19:46', 'CAP ADAY KIT ', 4, NULL, '0', '2', 'Local', '2597', NULL, '', '2023-01-22', 0, NULL, NULL, '1100', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 10:19:46.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650539376757', '2022-04-21 11:09:36', 'CAP GINSOMIN (PER CARD) ', 5, NULL, '0', '2', 'Local', '3168', NULL, '', '2023-02-26', 0, NULL, NULL, '900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 11:09:36.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650539967163', '2022-04-21 11:19:27', 'BRETT MOUTH WASH 250ML ', 6, NULL, '0', '1', 'Local', '3189', NULL, '', '2024-11-29', 0, NULL, NULL, '700', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 11:19:27.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650548908392', '2022-04-21 13:48:28', 'CAP BAROLE 20MG (PER CARD) ', 7, NULL, '0', '2', 'Local', '3023', NULL, '', '2023-12-25', 0, NULL, NULL, '1000', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 13:48:28.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650549813555', '2022-04-21 14:03:33', 'CAP CYPRON ', 8, NULL, '0', '2', 'Local', '2609', NULL, '', '2026-06-27', 0, NULL, NULL, '320', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:03:33.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650549813556', '2022-04-21 14:03:33', 'CAP FLUMOX 500MG ', 9, NULL, '0', '1', 'Local', '1592', NULL, '', '2023-10-29', 0, NULL, NULL, '2400', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:03:33.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650550527585', '2022-04-21 14:15:27', '23G DISPOSABLE NEEDLE ', 10, NULL, '0', '1', 'Local', '2663', NULL, '', '2026-06-27', 0, NULL, NULL, '20', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:15:27.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650550527588', '2022-04-21 14:15:27', '5 DEXTROSE SALINE (UNIQUE)', 11, NULL, '0', '1', 'Local', '2228', NULL, '', '2025-08-28', 0, NULL, NULL, '900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:15:27.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650551823267', '2022-04-21 14:37:03', 'BIOFLOR POWDER ', 12, NULL, '0', '1', 'Local', '2886', NULL, '', '2022-06-22', 0, NULL, NULL, '200', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:37:03.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650551823273', '2022-04-21 14:37:03', 'BIOFLOR POWDER ', 13, NULL, '0', '2', 'Local', '2909', NULL, '', '2022-06-05', 0, NULL, NULL, '201', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:37:03.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('1650551883538', '2022-04-21 14:38:03', 'BACTROBAN CREAM (MUPIROCIN)', 14, NULL, '0', '1', 'Local', '2764', NULL, '', '2023-05-30', 0, NULL, NULL, '2300', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-04-21 14:38:03.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('', '2022-04-23', ' GTT DRUPHAGAN', 15, '20220423022335', '1000', '0', '', '2906', NULL, '0', '2022-12-31', 1000, 1000, '0', '1000', 'Purchase order', '', '', NULL, '2022-04-23 13:23:35.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '5ca789cc-01dd-4777-959e-45ab960738ac', 'Usman', 1000, 'Purchase Order', ''),
('', '2022-04-23', '10CC SYRINGE ', 16, '20220423022428', '1000', '0', '', '1644', NULL, '0', '2022-12-31', 100, 100, '0', '1000', 'Purchase order', '', '', NULL, '2022-04-23 13:24:28.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '2895b0b8-f1b1-4b11-9339-b0665d08df33', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-04-23', 'Goodline', 17, '20220423023353', '1000', '0', '', '9aa78d01-e833-4087-9b11-f0822f493f69', NULL, '0', '2022-12-31', 10000, 10000, '0', '1000', 'Purchase order', '', '', NULL, '2022-04-23 13:33:53.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Fahad', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 10000, 'Purchase Order', ''),
('', '2022-04-23', 'Panadol', 18, '20220423023353', '1000', '0', '', '8169bfa3-7441-4f55-9e03-e86ef1d5e7e8', NULL, '0', '2022-12-31', 10000, 10000, '0', '1000', 'Purchase order', '', '', NULL, '2022-04-23 13:33:53.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Fahad', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 10000, 'Purchase Order', ''),
('', '2022-04-23', 'Goodline', 19, '20220423023353', '1000', '0', '', '9aa78d01-e833-4087-9b11-f0822f493f69', NULL, '0', '2022-12-31', 10000, 10000, '0', '1000', 'Purchase order', '', '', NULL, '2022-04-23 14:35:03.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Fahad', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 10000, 'Purchase Order', ''),
('', '2022-04-23', 'Goodline', 20, '20220423023353', '1000', '0', '', '9aa78d01-e833-4087-9b11-f0822f493f69', NULL, '0', '2022-12-31', 10000, 10000, '0', '1000', 'Purchase order', '', '', NULL, '2022-04-23 14:35:45.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Fahad', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 10000, 'Purchase Order', ''),
('', '2022-04-23', 'Goodline', 21, '20220423023810', '100', '0', '', '9aa78d01-e833-4087-9b11-f0822f493f69', NULL, '0', '2022-12-31', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-04-23 13:38:10.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-04-23', 'Goodline', 22, '20220423023810', '100', '0', '', '9aa78d01-e833-4087-9b11-f0822f493f69', NULL, '0', '2022-12-31', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-04-23 14:39:06.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-04-23', 'Goodline', 23, '20220423023940', '10000', '0', '', '9aa78d01-e833-4087-9b11-f0822f493f69', NULL, '0', '2022-12-31', 10000, 10000, '0', '10000', 'Purchase order', '', 'Fahad Store', NULL, '2022-04-23 13:39:40.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Fahad', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 10000, 'Purchase Order', ''),
('', '2022-04-23', 'Panadoline', 24, '20220423024049', '1000', '0', '', '78fc938e-939d-461a-9d31-7665ba923e70', NULL, '0', '2022-12-31', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-04-23 13:40:49.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-04-23', 'Panadoline', 25, '20220423024123', '1000', '0', '', '78fc938e-939d-461a-9d31-7665ba923e70', NULL, '0', '2022-12-31', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-04-23 13:41:23.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-04-23', 'Panadoline', 26, '20220423024203', '1000', '0', '', '78fc938e-939d-461a-9d31-7665ba923e70', NULL, '0', '1111-11-11', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-04-23 13:42:03.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-05-16', 'Anpasolin', 27, '20220516030335', '1000', '0', '', '486e769c-061a-4e7f-ace4-4217d2849d3a', NULL, '0', '2022-05-31', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-05-16 14:03:35.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '2895b0b8-f1b1-4b11-9339-b0665d08df33', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('', '2022-05-16', 'Angolin', 28, '20220516032455', '90', '0', '', '4bb1cb89-29a8-43f5-8c6c-9b032c1ab97e', NULL, '0', '2022-05-18', 100, 100, '0', '200', 'Purchase order', '', 'Fahad Store', NULL, '2022-05-16 14:24:55.000000', 'admin123', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', 'Fahad Ado Muhammad', 10, 'Purchase Order', ''),
('', '2022-05-16', 'Angolin', 29, '20220516032455', '1000', '0', '', 'd8bd1ed8-e357-43e1-8b05-ec576fd21852', NULL, '0', '2022-12-31', 1000, 1000, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-05-16 14:24:55.000000', 'admin123', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('1652711139001', '2022-05-16 14:25:39', 'Angolin', 30, NULL, '0', '2', 'Local', 'd8bd1ed8-e357-43e1-8b05-ec576fd21852', NULL, '', '2022-12-31', 0, NULL, NULL, '1000', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-16 14:25:39.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin123'),
('1652711179113', '2022-05-16 14:26:19', 'Angolin', 31, NULL, '0', '10', 'Local', '4bb1cb89-29a8-43f5-8c6c-9b032c1ab97e', NULL, '', '2022-05-18', 0, NULL, NULL, '200', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-16 14:26:19.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin123'),
('', '2022-05-17', 'Pandol', 32, '20220517034232', '100', '0', '', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '0', '2022-12-31', 1000, 1000, '0', '1900', 'Purchase order', '', 'Fahad Store', NULL, '2022-05-17 14:42:32.000000', 'doooo', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', 'f0e15c5c-31b2-4ee0-aba9-ae383403602a', 'Fahad Ado Muhammad', 10, 'Purchase Order', ''),
('1652798582177', '2022-05-17 14:43:02', 'Pandol', 33, NULL, '0', '2', 'Local', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '', '2022-12-31', 0, NULL, NULL, '1900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 14:43:02.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'doooo'),
('1652799467314', '2022-05-17 14:57:47', 'Pandol', 34, NULL, '0', '1', 'Local', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '', '2022-12-31', 0, NULL, NULL, '1900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 14:57:47.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'doooo'),
('1652799534884', '2022-05-17 14:58:54', 'Pandol', 35, NULL, '0', '2', 'Local', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '', '2022-12-31', 0, NULL, NULL, '1900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 14:58:54.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'doooo'),
('1652799700503', '2022-05-17 15:01:40', 'Pandol', 36, NULL, '0', '2', 'Local', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '', '2022-12-31', 0, NULL, NULL, '1900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 15:01:40.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'doooo'),
('1652799731432', '2022-05-17 15:02:11', 'Pandol', 37, NULL, '0', '1', 'Local', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '', '2022-12-31', 0, NULL, NULL, '1900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 15:02:11.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'doooo'),
('1652799981748', '2022-05-17 15:06:21', 'Pandol', 38, NULL, '0', '1', 'Local', 'a838142b-6a4e-44bf-b624-c59b5c988b6a', NULL, '', '2022-12-31', 0, NULL, NULL, '1900', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 15:06:21.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'doooo'),
('1652800378256', '2022-05-17 15:12:58', 'Anpasolin', 39, NULL, '0', '1', 'Local', '486e769c-061a-4e7f-ace4-4217d2849d3a', NULL, '', '2022-05-31', 0, NULL, NULL, '1000', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-05-17 15:12:58.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin'),
('', '2022-07-07', 'Amozine', 40, '20220707111519', '1000', '0', '', 'e5e33ece-3e59-4d68-9a60-07630c3fafe1', NULL, '0', '2024-12-31', 100, 100, '0', '1000', 'Purchase order', '', 'Fahad Store', NULL, '2022-07-07 10:15:19.000000', 'admin', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', NULL, '', 'Pandano', '', '', '', '7ecc0624-7667-4366-a81c-6f09ad8f5750', 'Fahad Ado Muhammad', 1000, 'Purchase Order', ''),
('1657188960696', '2022-07-07 10:16:00', 'Amozine', 41, NULL, '0', '2', 'Local', 'e5e33ece-3e59-4d68-9a60-07630c3fafe1', NULL, '', '2024-12-31', 0, NULL, NULL, '1000', 'Fahad Store', 'pos', 'Fahad Store', NULL, '2022-07-07 10:16:00.000000', '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '', '', '', '', '', '', '', '', NULL, 'sales', 'admin');

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

--
-- Table structure for table `suppliersinfo`
--

CREATE TABLE `suppliersinfo` (
  `facilityId` varchar(50) NOT NULL,
  `id` int(50) NOT NULL,
  `supplier_name` varchar(100) DEFAULT NULL,
  `date` datetime NOT NULL DEFAULT current_timestamp(),
  `address` varchar(250) DEFAULT NULL,
  `phone` varchar(100) DEFAULT NULL,
  `supplier_code` varchar(100) NOT NULL,
  `balance` int(11) DEFAULT NULL,
  `status` varchar(20) DEFAULT NULL,
  `website` varchar(100) DEFAULT NULL,
  `tinnumber` varchar(50) DEFAULT NULL,
  `supplier_type` varchar(40) DEFAULT NULL,
  `vat` varchar(50) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `other_info` varchar(100) DEFAULT NULL,
  `version_id` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `suppliersinfo`
--

INSERT INTO `suppliersinfo` (`facilityId`, `id`, `supplier_name`, `date`, `address`, `phone`, `supplier_code`, `balance`, `status`, `website`, `tinnumber`, `supplier_type`, `vat`, `email`, `other_info`, `version_id`) VALUES
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 1, 'Fahad Ado Muhammad', '2022-04-16 09:40:30', '108 gama', '', '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', -119944656, NULL, '', '0', '', '0', '', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 2, 'Fahad Ado Muhammad', '2022-04-21 08:37:22', '108 gama', '08067643479', '2895b0b8-f1b1-4b11-9339-b0665d08df33', -2075001, NULL, 'gmail.com', '0', '', '0', '8790fahadado@gmail.com', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 3, 'Usman', '2022-04-21 08:38:14', '', '', '5ca789cc-01dd-4777-959e-45ab960738ac', -998000, NULL, '', '0', '', '0', '', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 4, 'Umar', '2022-04-21 08:40:10', '', '', '62b7bf5c-9ff1-4245-a754-323ca7bb07d7', 0, NULL, '', '0', '', '0', '', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 5, 'Usman', '2022-04-21 08:40:59', '', '', '5f5e4ccf-427d-497c-9660-f997ac025125', 0, NULL, '', '0', '', '0', '', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 6, 'Fahad Ado Muhammad', '2022-04-21 09:50:49', '108 gama', '', '64219369-15fc-40b8-ad50-712f823b346b', 0, NULL, '', '0', '', '0', '', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 7, 'Fahad Ado Muhammad', '2022-04-21 09:53:11', '108 gama', '', '7d86dfc7-3a66-42cd-91a0-1d3d63c57da2', 0, NULL, '', '0', '', '0', '', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 8, 'Fahad Ado Muhammad', '2022-04-23 13:33:09', '108 gama', '08067643479', '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', -133200000, NULL, 'gmail.com', '0', '', '0', '08067643479', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 9, 'Fahad Ado Muhammad', '2022-05-16 14:22:24', '108 gama', '08067643479', 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', -1009000, NULL, 'gmail.com', '0', '', '0', '8790fahadado@gmail.com', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 10, 'Fahad Ado Muhammad', '2022-05-17 14:41:28', '108 gama', '08067643479', 'f0e15c5c-31b2-4ee0-aba9-ae383403602a', -100000, NULL, 'www.gmail.com', '0', '', '0', '08067643479', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 11, 'Fahad Ado Muhammad', '2022-07-07 10:14:00', '108 Gama C Ahmadiyyah Street Kano City.', '+2348067643479', '7ecc0624-7667-4366-a81c-6f09ad8f5750', -98100, NULL, 'fahad.com', '0', '', '0', '08067643479', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 12, 'Fahad Ado Muhammad', '2022-08-14 15:28:29', '108 Gama C Ahmadiyyah Street Kano City.', '+2348067643479', '9945b3d0-cc5e-40e7-8510-4b13518090f5', 1000, NULL, 'gmail.com', '0', '', '0', '8790fahadado@gmail.com', '', ''),
('1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', 13, 'Fahad Ado Muhammad', '2022-08-14 15:33:01', '108 Gama C Ahmadiyyah Street Kano City.', '+2348067643479', 'cf2c72da-6ecc-476a-a6d9-c3ecff411f11', 2100, NULL, 'gmail.com', '0', '', '0', '08067643479', '', '');

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

--
-- Table structure for table `supplier_entries`
--

CREATE TABLE `supplier_entries` (
  `entry_id` int(11) NOT NULL,
  `supplier_id` varchar(50) NOT NULL,
  `dr` float NOT NULL,
  `cr` float NOT NULL,
  `reference_no` varchar(50) NOT NULL,
  `facilityId` varchar(50) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `description` varchar(50) NOT NULL,
  `truckNo` varchar(50) DEFAULT NULL,
  `waybillNo` varchar(50) DEFAULT NULL,
  `version_id` varchar(50) DEFAULT NULL,
  `cost_price` int(11) DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `supplier_entries`
--

INSERT INTO `supplier_entries` (`entry_id`, `supplier_id`, `dr`, `cr`, `reference_no`, `facilityId`, `created_at`, `description`, `truckNo`, `waybillNo`, `version_id`, `cost_price`, `quantity`) VALUES
(1, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 10000, '16042223', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-16 09:40:47', 'Payment', NULL, NULL, '', NULL, NULL),
(2, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 100000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-16 09:45:22', 'Kawama', '', '', '', 100000, 1000),
(3, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 12345, '18042213', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-18 08:52:50', 'Payment', NULL, NULL, '', NULL, NULL),
(4, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 10000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-19 18:15:42', '2CC SYRINGE ', '', '', '', 10000, 1000),
(5, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 10000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-19 18:15:58', '2CC SYRINGE ', '', '', '', 10000, 1000),
(6, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 1, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-21 09:41:28', 'BIOCOTEN CREAM ', '', '', '', 1, 1),
(7, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-21 09:43:42', '5CC SYRINGE ', '', '', '', 1000, 1000),
(8, '5ca789cc-01dd-4777-959e-45ab960738ac', 0, 1000, '21042216', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-21 09:52:06', 'Payment', NULL, NULL, '', NULL, NULL),
(9, '5ca789cc-01dd-4777-959e-45ab960738ac', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:23:35', ' GTT DRUPHAGAN', '', '', '', 1000, 1000),
(10, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 100000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:24:28', '10CC SYRINGE ', '', '', '', 100, 1000),
(11, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 10000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:33:53', 'Goodline', '', '', '', 10000, 1000),
(12, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 10000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:33:53', 'Panadol', '', '', '', 10000, 1000),
(13, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 10000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:35:03', 'Goodline', '', '', '', 10000, 1000),
(14, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 10000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:35:45', 'Goodline', '', '', '', 10000, 1000),
(15, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 100000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:38:10', 'Goodline', '', '', '', 1000, 100),
(16, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 100000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:39:06', 'Goodline', '', '', '', 1000, 100),
(17, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 100000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:39:40', 'Goodline', '', '', '', 10000, 10000),
(18, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:40:49', 'Panadoline', '', '', '', 1000, 1000),
(19, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:41:23', 'Panadoline', '', '', '', 1000, 1000),
(20, '19ee44c1-4c95-4f68-9aca-68ad7b29ee62', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-04-23 13:42:03', 'Panadoline', '', '', '', 1000, 1000),
(21, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-05-16 14:03:35', 'Anpasolin', '', '', '', 1000, 1000),
(22, 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', 9000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-05-16 14:24:55', 'Angolin', '', '', '', 100, 90),
(23, 'faae946f-d218-4cd1-a1e0-dbd2edb0d0ec', 1000000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-05-16 14:24:55', 'Angolin', '', '', '', 1000, 1000),
(24, 'f0e15c5c-31b2-4ee0-aba9-ae383403602a', 100000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-05-17 14:42:32', 'Pandol', '', '', '', 1000, 100),
(25, '7ecc0624-7667-4366-a81c-6f09ad8f5750', 0, 1900, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-07-07 10:14:00', 'Opening Balance', '', '', '', 0, 0),
(26, '7ecc0624-7667-4366-a81c-6f09ad8f5750', 100000, 0, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-07-07 10:15:19', 'Amozine', '', '', '', 100, 1000),
(27, 'cf2c72da-6ecc-476a-a6d9-c3ecff411f11', 0, 1000, '', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 15:33:01', 'Opening Balance', '', '', '', 0, 0),
(28, 'cf2c72da-6ecc-476a-a6d9-c3ecff411f11', 0, 1000, '151', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 15:42:09', 'Payment', NULL, NULL, NULL, NULL, NULL),
(29, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 15:53:46', 'Payment', NULL, NULL, NULL, NULL, NULL),
(30, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 10000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 15:54:29', 'Payment', NULL, NULL, NULL, NULL, NULL),
(31, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:06:03', 'Payment', NULL, NULL, NULL, NULL, NULL),
(32, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:07:27', 'Payment', NULL, NULL, NULL, NULL, NULL),
(33, '9945b3d0-cc5e-40e7-8510-4b13518090f5', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:12:32', 'Payment', NULL, NULL, NULL, NULL, NULL),
(34, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:15:57', 'Payment', NULL, NULL, NULL, NULL, NULL),
(35, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 10000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:16:59', 'Payment', NULL, NULL, NULL, NULL, NULL),
(36, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:17:41', 'Payment', NULL, NULL, NULL, NULL, NULL),
(37, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 10000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:19:46', 'pp', NULL, NULL, NULL, NULL, NULL),
(38, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 10000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:20:54', 'Payment', NULL, NULL, NULL, NULL, NULL),
(39, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 10000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:21:47', 'Payment', NULL, NULL, NULL, NULL, NULL),
(40, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:22:30', 'Payment', NULL, NULL, NULL, NULL, NULL),
(41, '6d0f8040-0e3f-4074-b725-e3c3d89ad43c', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:23:45', 'Payment', NULL, NULL, NULL, NULL, NULL),
(42, '5ca789cc-01dd-4777-959e-45ab960738ac', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:24:35', 'Payment', NULL, NULL, NULL, NULL, NULL),
(43, '2895b0b8-f1b1-4b11-9339-b0665d08df33', 0, 1000, '15251', '1be0a9da-bff9-4ab6-a36c-edfd8ca88f1a', '2022-08-14 16:26:22', 'Payment', NULL, NULL, NULL, NULL, NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `pharm_store`
--
ALTER TABLE `pharm_store`
  ADD PRIMARY KEY (`drug_name`,`item_code`,`expiry_date`,`store`),
  ADD UNIQUE KEY `uniq` (`item_id`),
  ADD KEY `facilityId` (`facilityId`);

--
-- Indexes for table `pharm_store_entries`
--
ALTER TABLE `pharm_store_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transfer_from` (`transfer_from`,`transfer_to`,`branch_name`,`facilityId`),
  ADD KEY `inserted_time` (`inserted_time`);

--
-- Indexes for table `suppliersinfo`
--
ALTER TABLE `suppliersinfo`
  ADD PRIMARY KEY (`supplier_code`),
  ADD UNIQUE KEY `supplier_code` (`supplier_code`),
  ADD UNIQUE KEY `id` (`id`) USING BTREE;

--
-- Indexes for table `supplier_entries`
--
ALTER TABLE `supplier_entries`
  ADD PRIMARY KEY (`entry_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

--
-- AUTO_INCREMENT for table `suppliersinfo`
--
ALTER TABLE `suppliersinfo`
  MODIFY `id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `supplier_entries`
--
ALTER TABLE `supplier_entries`
  MODIFY `entry_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;
COMMIT;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_add_new_pharm_store`(IN `in_store_name` VARCHAR(100), IN `in_store_location` VARCHAR(100), IN `in_phone_number` VARCHAR(100), IN `in_store_type` VARCHAR(100), IN `in_address` VARCHAR(100), IN `in_manage_by` VARCHAR(100), IN `in_facilityId` VARCHAR(100), IN `in_created_by` VARCHAR(100), IN `in_pharm_name` VARCHAR(100), IN `in_store_code` VARCHAR(100), IN `status` VARCHAR(50))
    NO SQL
BEGIN
if status='insert' THEN

INSERT INTO `pharm_branches`( `branch_name`, `location`, `address`, `phone`, `store_type`, `created_time`, `facilityId`, `admin_name`, `created_by`,store_code,manage_by) VALUES (in_store_name,in_store_location,in_address,in_phone_number,in_store_type,now(),in_facilityId,in_created_by,in_manage_by,in_store_code,in_manage_by);
ELSE
UPDATE `pharm_branches` SET `location`=in_store_location,`phone`=in_phone_number,`store_type`=in_store_type,`address`=in_address,`manage_by`=in_manage_by WHERE store_code=in_store_code and facilityId=in_facilityId;
end if;
END$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_add_new_supplier`(IN `in_facilityId` VARCHAR(50), IN `in_supplier_name` VARCHAR(100), IN `in_address` VARCHAR(100), IN `in_phone` VARCHAR(20), IN `in_supplier_code` VARCHAR(50), IN `in_tinnumber` INT, IN `in_supplier_type` VARCHAR(50), IN `in_website` VARCHAR(40), IN `in_vat` INT, IN `in_email` VARCHAR(50), IN `in_other_info` VARCHAR(50), IN `in_version_id` VARCHAR(50), IN `in_balance` INT)
begin
declare supplier_balance,new_supplier_balance float;

SELECT balance into supplier_balance from suppliersinfo WHERE supplier_code=in_supplier_code ;

if supplier_balance is null  THEN
INSERT INTO suppliersinfo(facilityId,supplier_name,address,phone,supplier_code,tinnumber,supplier_type,website,vat, email,other_info,version_id, balance)
  VALUES (in_facilityId,in_supplier_name,in_address,in_phone,in_supplier_code,in_tinnumber,in_supplier_type,in_website,in_vat, in_email,in_other_info,in_version_id, in_balance);
 	IF in_balance != 0 THEN
	INSERT INTO `supplier_entries`(`supplier_id`, `dr`, `cr`, `reference_no`, `facilityId`, `created_at`, `description`, `truckNo`, `waybillNo`, `version_id`, `cost_price`, `quantity`) 
    VALUES (in_supplier_code, 0,in_balance, '', in_facilityId, now(), 'Opening Balance', 
           '', '', in_version_id, 0, 0);
           end if;
	ELSEIF in_balance = 0 THEN 
    INSERT INTO suppliersinfo(facilityId,supplier_name,address,phone,supplier_code,tinnumber,supplier_type,website,vat, email,other_info,version_id, balance)
  VALUES (in_facilityId,in_supplier_name,in_address,in_phone,in_supplier_code,in_tinnumber,in_supplier_type,in_website,in_vat, in_email,in_other_info,in_version_id, in_balance);
  ELSEIF in_balance>0 THEN
    SET new_supplier_balance=supplier_balance+ in_balance;
    
    update suppliersinfo set balance=new_supplier_balance WHERE supplier_code=in_supplier_code;
    
	INSERT INTO `supplier_entries`(`supplier_id`, `dr`, `cr`, `reference_no`, `facilityId`, `created_at`, `description`, `truckNo`, `waybillNo`, `version_id`, `cost_price`, `quantity`) 
    VALUES (in_supplier_code, 0,abs(in_balance), '', in_facilityId, now(), 'Opening Balance', 
           '', '', in_version_id, 0, 0);
           ELSEIF in_balance < 0 THEN
    SET new_supplier_balance=supplier_balance+ in_balance;
    
    update suppliersinfo set balance=new_supplier_balance WHERE supplier_code=in_supplier_code;
    
	INSERT INTO `supplier_entries`(`supplier_id`, `dr`, `cr`, `reference_no`, `facilityId`, `created_at`, `description`, `truckNo`, `waybillNo`, `version_id`, `cost_price`, `quantity`) 
    VALUES (in_supplier_code, 0,in_balance, '', in_facilityId, now(), 'Opening Balance', 
           '', '', in_version_id, 0, 0);
end if;
end$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_drug_view`(IN `in_branch_name` VARCHAR(100), IN `in_item_code` VARCHAR(100), IN `in_facilityId` VARCHAR(50), IN `in_date_from` DATE, IN `in_date_to` DATE, IN `in_drug_name` VARCHAR(100), IN `in_expiry_date` DATE)
    NO SQL
SELECT expiry_date,receive_date,drug_name,branch_name as store,qty_in,qty_out,selling_price FROM `pharm_store_entries` WHERE branch_name=in_branch_name and drug_name=in_drug_name and expiry_date=in_expiry_date and item_code=in_item_code and facilityId=in_facilityId and date(inserted_time) between in_date_from and in_date_to$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_expiry_alert`(IN `facId` VARCHAR(50))
    NO SQL
SELECT * FROM pharm_store WHERE DATE_FORMAT(expiry_date, '%Y-%m-%d') BETWEEN DATE_FORMAT(NOW(), '%Y-%m-%d') AND DATE_FORMAT(DATE_ADD(NOW(),INTERVAL 6 MONTH), '%Y-%m-%d')  AND (facilityId=facId) ORDER by expiry_date ASC$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_pharm_store`(IN `in_facilityId` VARCHAR(50))
    NO SQL
SELECT branch_name as store_name,store_code,location as location,phone as phone,store_type as storeType,address,manage_by as manage_by FROM `pharm_branches` WHERE facilityId=in_facilityId$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_pharm_users`(IN `in_facilityId` VARCHAR(50))
    NO SQL
SELECT * FROM users where facilityId=in_facilityId$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_purchase_drugs`(IN `in_facilityId` VARCHAR(50), IN `in_from` INT(15), IN `in_to` INT(15), IN `in_query_type` VARCHAR(100))
    NO SQL
begin
if in_query_type="all" THEN
SELECT * FROM `pharm_store` WHERE facilityId=in_facilityId;

ELSE 
SELECT * FROM `pharm_store` WHERE facilityId=in_facilityId and balance>0 LIMIT in_from,in_to;
end if;
end$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_reorder_level`(IN `facId` VARCHAR(50))
    NO SQL
SELECT * FROM pharm_store WHERE balance < reoder_level AND facilityId=facId and balance>0$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_supplier_count`(IN `in_facilityId` VARCHAR(50))
    NO SQL
SELECT COUNT(*) as num FROM `suppliersinfo` WHERE facilityId=in_facilityId$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_supplier_info`(IN `in_facilityId` VARCHAR(50))
    NO SQL
SELECT `facilityId`, `supplier_name`, `date`, `address`, `phone`, `supplier_code`, `balance`, `tinnumber` `email` FROM `suppliersinfo` WHERE facilityId=in_facilityId$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_get_supplierr_statement`(IN `in_supplier_code` VARCHAR(50), IN `in_date_from` DATE, IN `in_date_to` DATE, IN `in_facilityId` VARCHAR(60))
SELECT  0 AS `total`,`entry_id`, `supplier_id`, `dr`, `cr`, `reference_no`, `facilityId`, `created_at`, `description`, `truckNo`, `waybillNo`, `version_id`, `cost_price`, `quantity` FROM supplier_entries where supplier_id=in_supplier_code and date(created_at) between in_date_from and in_date_to AND  facilityId=in_facilityId$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_supplier_payment`(IN `in_facId` VARCHAR(50), IN `userId` VARCHAR(50), IN `in_acct` VARCHAR(50), IN `Amount_paid` INT, IN `in_receiptDateSN` VARCHAR(50), IN `in_receiptSN` VARCHAR(50), IN `in_mode_of_payment` VARCHAR(50), IN `sourceAcct` VARCHAR(50), IN `in_description` VARCHAR(100), IN `in_date` DATETIME, IN `in_payables_head` VARCHAR(50))
BEGIN

declare supplier_balance double;
    declare main_balance double;
    DECLARE balance_paid DOUBLE;
    
    select balance into supplier_balance from suppliersinfo where supplier_code=in_acct AND facilityId=in_facId;

    set main_balance = supplier_balance+Amount_paid;
    
    update suppliersinfo set balance= main_balance  where supplier_code=in_acct AND facilityId=in_facId;
    
    
     insert into supplier_entries (supplier_id,dr,cr,reference_no,facilityId,description)
           values (in_acct,0,Amount_paid,in_receiptDateSN,in_facId,in_description);
           
      
     -- insert into transactions (description,acct,debit,credit,receiptDateSN,receiptNo,modeOfPayment,enteredBy,client_acct,facilityId,createdAt,version_id)
        --   values (in_description,sourceAcct,0,Amount_paid,in_receiptDateSN,in_receiptSN,in_mode_of_payment,userId,in_acct,in_facId,in_date,in_version_id);
          
           
          -- insert into transactions (description,acct,debit,credit,receiptDateSN,receiptNo,modeOfPayment,enteredBy,client_acct,facilityId,createdAt,version_id)
         --  values (in_description,in_payables_head,0,abs(Amount_paid) ,in_receiptDateSN,in_receiptSN,in_mode_of_payment,userId,in_acct,in_facId,in_date, concat(in_version_id,'-1'));
END$$
DELIMITER ;

DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pharm_update_store`(IN `in_selling_price` FLOAT(11), IN `in_expiry_date` DATE, IN `in_drug_name` VARCHAR(100), IN `in_item_code` VARCHAR(100), IN `in_store` VARCHAR(100), IN `in_facilityId` VARCHAR(100))
update pharm_store set selling_price=in_selling_price WHERE expiry_date=in_expiry_date and drug_name=in_drug_name and item_code=in_item_code and store=in_store and facilityId=in_facilityId$$
DELIMITER ;


