Add files via upload

This commit is contained in:
gopi17701 2018-09-15 23:03:55 -04:00 committed by GitHub
parent 1cc897ea62
commit a502eca930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,13 +99,14 @@ CREATE TABLE IF NOT EXISTS `customer` (
PRIMARY KEY (`customer_id`) PRIMARY KEY (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.customer: ~4 rows (approximately) -- Dumping data for table astute.customer: ~5 rows (approximately)
/*!40000 ALTER TABLE `customer` DISABLE KEYS */; /*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` (`customer_id`, `customer_name`, `bill_to_dept`, `add1`, `add2`, `city`, `state`, `zip`, `zip_last_4`, `email`, `phone`, `fax`) VALUES INSERT INTO `customer` (`customer_id`, `customer_name`, `bill_to_dept`, `add1`, `add2`, `city`, `state`, `zip`, `zip_last_4`, `email`, `phone`, `fax`) VALUES
('1', 'test4565', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', '123-123-1233', '123-123-1233'), ('1', 'test4565', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', '123-123-1233', '123-123-1233'),
('2', 'test123', 'test123', 'test123', NULL, 'test123', 'md', 20874, 0, NULL, '0', '0'), ('2', 'test123', 'test123', 'test123', NULL, 'test123', 'md', 20874, 0, NULL, '0', '0'),
('3', 'Hampton Road Transit', 'Accounts Payable', '3400 Victoria Blvd', '', 'Hampton', 'VA', 23661, 0, 'wcollins@hrtransit.org', '7572226000', '7572226000'), ('3', 'Hampton Road Transit', 'Accounts Payable', '3400 Victoria Blvd', '', 'Hampton', 'VA', 23661, 0, 'wcollins@hrtransit.org', '7572226000', '7572226000'),
('Gopi', 'Gopi', 'Gopi', '123 Gopi st', '', 'GGG', 'GA', 12345, 0, 'Gopi@Gopi.com', '(123) 123-1233', ''), ('Gopi', 'Gopi', 'Gopi', '123 Gopi st', '', 'GGG', 'GA', 12345, 0, 'Gopi@Gopi.com', '(123) 123-1233', ''),
('GopiTest', 'GopiTest', 'GopiTest', 'GopiTest', '', 'Germantown', 'MD', 20874, 0, 'abc@abc.com', '(123) 123-1233', '(123) 123-1233'),
('test500', 'test500', 'test500', 'test500', 'test500', 'test500', 'md', 20874, 1234, 'Test@Test.com', '1231231233', '131231233'); ('test500', 'test500', 'test500', 'test500', 'test500', 'test500', 'md', 20874, 1234, 'Test@Test.com', '1231231233', '131231233');
/*!40000 ALTER TABLE `customer` ENABLE KEYS */; /*!40000 ALTER TABLE `customer` ENABLE KEYS */;
@ -195,7 +196,7 @@ DELIMITER ;
DELIMITER // DELIMITER //
CREATE DEFINER=`root`@`localhost` FUNCTION `generate_inv_number`(po_num_in varchar(20)) RETURNS varchar(40) CHARSET utf8 CREATE DEFINER=`root`@`localhost` FUNCTION `generate_inv_number`(po_num_in varchar(20)) RETURNS varchar(40) CHARSET utf8
BEGIN BEGIN
DECLARE customer_id_in int; DECLARE customer_id_in varchar(20);
DECLARE customer_code varchar(4); DECLARE customer_code varchar(4);
DECLARE po_count int; DECLARE po_count int;
DECLARE inv_count int; DECLARE inv_count int;
@ -216,10 +217,11 @@ BEGIN
FROM po FROM po
WHERE PO_num = po_num_in; WHERE PO_num = po_num_in;
SELECT count(*) + 1 SELECT inv_seq + 1
INTO inv_count INTO inv_count
FROM invoice FROM PO
WHERE invoice.PO_num = po_num_in; WHERE PO.PO_num = po_num_in;
SELECT concat(customer_code, '-',LPAD(po_count, 2, '0'), '_DRAFT_',date_format(now(),'%j')) INTO inv_number; SELECT concat(customer_code, '-',LPAD(po_count, 2, '0'), '_DRAFT_',date_format(now(),'%j')) INTO inv_number;
RETURN inv_number; RETURN inv_number;
@ -264,6 +266,7 @@ CREATE TABLE IF NOT EXISTS `invoice` (
-- Dumping data for table astute.invoice: ~11 rows (approximately) -- Dumping data for table astute.invoice: ~11 rows (approximately)
/*!40000 ALTER TABLE `invoice` DISABLE KEYS */; /*!40000 ALTER TABLE `invoice` DISABLE KEYS */;
INSERT INTO `invoice` (`inv_no`, `inv_date`, `PO_num`, `bill_amt`, `special_notes`, `certification`, `inv_status`, `pmt_status`) VALUES INSERT INTO `invoice` (`inv_no`, `inv_date`, `PO_num`, `bill_amt`, `special_notes`, `certification`, `inv_status`, `pmt_status`) VALUES
('1-01_0915_1', '2017-12-28', 'EP2649247', 16854, '1. Completion of Phase 1 - Preliminaries\r\n2. Invoice not submitted to NVCC. For submitted invoice, see Excel copy\r\n', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned.', 2, 1),
('Hamp-01_1808_01', '2018-08-23', 'HRT-16-72046', 8000, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 2, 1), ('Hamp-01_1808_01', '2018-08-23', 'HRT-16-72046', 8000, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 2, 1),
('Hamp-01_1808_02', '2018-08-23', 'HRT-16-72046', 1500, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1), ('Hamp-01_1808_02', '2018-08-23', 'HRT-16-72046', 1500, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1),
('Hamp-01_1808_03', '2018-08-23', 'HRT-16-72046', 1500, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1), ('Hamp-01_1808_03', '2018-08-23', 'HRT-16-72046', 1500, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1),
@ -272,7 +275,6 @@ INSERT INTO `invoice` (`inv_no`, `inv_date`, `PO_num`, `bill_amt`, `special_note
('Hamp-01_1808_06', '2018-08-23', 'HRT-16-72046', 2000, 'TEST', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1), ('Hamp-01_1808_06', '2018-08-23', 'HRT-16-72046', 2000, 'TEST', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1),
('Hamp-01_1808_07', '2018-08-23', 'HRT-16-72046', 1000, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1), ('Hamp-01_1808_07', '2018-08-23', 'HRT-16-72046', 1000, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1),
('Hamp-01_1808_08', '2018-08-23', 'HRT-16-72046', 1000, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1), ('Hamp-01_1808_08', '2018-08-23', 'HRT-16-72046', 1000, 'Test', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned', 1, 1),
('test-04_1807_DRAFT', '2017-12-28', 'EP2649247', 16854, '1. Completion of Phase 1 - Preliminaries\r\n2. Invoice not submitted to NVCC. For submitted invoice, see Excel copy\r\n', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned.', 1, 1),
('test101', '2017-12-28', 'EP2649247', 16854, '1. Completion of Phase 1 - Preliminaries\r\n2. Invoice not submitted to NVCC. For submitted invoice, see Excel copy\r\n', 'Certification: Certified that the above items and rates are in accordnace with the contractual aggrement as verified by the undersigned', 1, 1), ('test101', '2017-12-28', 'EP2649247', 16854, '1. Completion of Phase 1 - Preliminaries\r\n2. Invoice not submitted to NVCC. For submitted invoice, see Excel copy\r\n', 'Certification: Certified that the above items and rates are in accordnace with the contractual aggrement as verified by the undersigned', 1, 1),
('test500', '2017-12-28', 'EP2649247', 16854, '1. Completion of Phase 1 - Preliminaries\r\n2. Invoice not submitted to NVCC. For submitted invoice, see Excel copy\r\n', 'Certification: Certified that the above items and rates are in accordnace with the contractual aggrement as verified by the undersigned', 1, 1); ('test500', '2017-12-28', 'EP2649247', 16854, '1. Completion of Phase 1 - Preliminaries\r\n2. Invoice not submitted to NVCC. For submitted invoice, see Excel copy\r\n', 'Certification: Certified that the above items and rates are in accordnace with the contractual aggrement as verified by the undersigned', 1, 1);
/*!40000 ALTER TABLE `invoice` ENABLE KEYS */; /*!40000 ALTER TABLE `invoice` ENABLE KEYS */;
@ -296,6 +298,12 @@ CREATE TABLE IF NOT EXISTS `invoice_detail` (
-- Dumping data for table astute.invoice_detail: ~16 rows (approximately) -- Dumping data for table astute.invoice_detail: ~16 rows (approximately)
/*!40000 ALTER TABLE `invoice_detail` DISABLE KEYS */; /*!40000 ALTER TABLE `invoice_detail` DISABLE KEYS */;
INSERT INTO `invoice_detail` (`inv_num`, `line_item_num`, `PO_line_item_num`, `service_type_id`, `description`, `qty`, `fee`, `fee_type_id`) VALUES INSERT INTO `invoice_detail` (`inv_num`, `line_item_num`, `PO_line_item_num`, `service_type_id`, `description`, `qty`, `fee`, `fee_type_id`) VALUES
('1-01_0915_1', 1, 1, NULL, 'test', NULL, 14953, 1),
('1-01_0915_1', 2, 3, NULL, 'Additional Services: Third Party Utility Verification', NULL, 1500, 1),
('1-01_0915_1', 3, 3, NULL, 'Additional Services: Field Investigatoin Travel', NULL, 321, 1),
('1-01_0915_1', 4, 4, NULL, 'Reimbursable Expense: Printing and parking', NULL, 80, 1),
('1-01_0915_1', 10, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1),
('1-01_0915_1', 11, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1),
('Hamp-01_1808_01', 1, 1, 0, 'test', 100, 14953, 1), ('Hamp-01_1808_01', 1, 1, 0, 'test', 100, 14953, 1),
('Hamp-01_1808_01', 2, 2, 2, 'Design Phase', 30, 100, 1), ('Hamp-01_1808_01', 2, 2, 2, 'Design Phase', 30, 100, 1),
('Hamp-01_1808_01', 3, 3, 4, 'Cost Estimation', 40, 100, 1), ('Hamp-01_1808_01', 3, 3, 4, 'Cost Estimation', 40, 100, 1),
@ -305,13 +313,7 @@ INSERT INTO `invoice_detail` (`inv_num`, `line_item_num`, `PO_line_item_num`, `s
('Hamp-01_1808_05', 1, 2, 2, 'Design Phase', 20, 100, 1), ('Hamp-01_1808_05', 1, 2, 2, 'Design Phase', 20, 100, 1),
('Hamp-01_1808_06', 1, 3, 4, 'Cost Estimation', 20, 100, 1), ('Hamp-01_1808_06', 1, 3, 4, 'Cost Estimation', 20, 100, 1),
('Hamp-01_1808_07', 1, 3, 4, 'Cost Estimation', 10, 100, 1), ('Hamp-01_1808_07', 1, 3, 4, 'Cost Estimation', 10, 100, 1),
('Hamp-01_1808_08', 1, 3, 4, 'Cost Estimation', 10, 100, 1), ('Hamp-01_1808_08', 1, 3, 4, 'Cost Estimation', 10, 100, 1);
('test-04_1807_DRAFT', 1, 1, NULL, 'test', NULL, 14953, 1),
('test-04_1807_DRAFT', 2, 3, NULL, 'Additional Services: Third Party Utility Verification', NULL, 1500, 1),
('test-04_1807_DRAFT', 3, 3, NULL, 'Additional Services: Field Investigatoin Travel', NULL, 321, 1),
('test-04_1807_DRAFT', 4, 4, NULL, 'Reimbursable Expense: Printing and parking', NULL, 80, 1),
('test-04_1807_DRAFT', 10, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1),
('test-04_1807_DRAFT', 11, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1);
/*!40000 ALTER TABLE `invoice_detail` ENABLE KEYS */; /*!40000 ALTER TABLE `invoice_detail` ENABLE KEYS */;
-- Dumping structure for table astute.invoice_notes -- Dumping structure for table astute.invoice_notes
@ -408,11 +410,12 @@ CREATE TABLE IF NOT EXISTS `po` (
CONSTRAINT `po_customer_id_fk` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) CONSTRAINT `po_customer_id_fk` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.po: ~9 rows (approximately) -- Dumping data for table astute.po: ~10 rows (approximately)
/*!40000 ALTER TABLE `po` DISABLE KEYS */; /*!40000 ALTER TABLE `po` DISABLE KEYS */;
INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`, `po_id`, `title`, `inv_seq`) VALUES INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`, `po_id`, `title`, `inv_seq`) VALUES
('ABC1234', 'ABC1234', '2018-08-23', 50000.00, '3', 'ABC1234', 2, 'new from HRT', 0), ('ABC1234', 'ABC1234', '2018-08-23', 50000.00, '3', 'ABC1234', 2, 'new from HRT', 0),
('EP2649247', 'ABC1234', '2018-08-27', 50000000.00, '1', 'ABC1234', 1, 'new from HRT 1234', 0), ('EP2649247', 'ABC1234', '2018-08-27', 50000000.00, '1', 'ABC1234', 1, 'new from HRT 1234', 1),
('GopiTestPO', 'GopiTestPO', '2018-09-15', 50000.00, 'GopiTest', 'GopiTestPO', 1, 'GopiTestPO', NULL),
('HRT-16-72046', '16-72046', '2018-08-07', 23360.00, '3', 'HRT-01-01', 1, 'SO Dummy Title for 16-72046 ', 1), ('HRT-16-72046', '16-72046', '2018-08-07', 23360.00, '3', 'HRT-01-01', 1, 'SO Dummy Title for 16-72046 ', 1),
('Real PO 123', 'Real PO 123', NULL, 100000.00, '1', 'Real PO 123', 6, 'Real PO 123 PO Tasks', 0), ('Real PO 123', 'Real PO 123', NULL, 100000.00, '1', 'Real PO 123', 6, 'Real PO 123 PO Tasks', 0),
('test12', 'test', '2018-07-11', 60000.00, '1', 'adf', 2, 'SO Dummy Title for test', 0), ('test12', 'test', '2018-07-11', 60000.00, '1', 'adf', 2, 'SO Dummy Title for test', 0),
@ -438,7 +441,7 @@ CREATE TABLE IF NOT EXISTS `po_detail` (
CONSTRAINT `fk_PODetail_ServType` FOREIGN KEY (`service_type_id`) REFERENCES `service_type` (`service_type_id`) CONSTRAINT `fk_PODetail_ServType` FOREIGN KEY (`service_type_id`) REFERENCES `service_type` (`service_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.po_detail: ~14 rows (approximately) -- Dumping data for table astute.po_detail: ~15 rows (approximately)
/*!40000 ALTER TABLE `po_detail` DISABLE KEYS */; /*!40000 ALTER TABLE `po_detail` DISABLE KEYS */;
INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id`, `qty`, `service_type_id`, `fee`, `remaining_qty`) VALUES INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id`, `qty`, `service_type_id`, `fee`, `remaining_qty`) VALUES
('EP2649247', 1, 'test', 2, 1000, 1, 50, 700), ('EP2649247', 1, 'test', 2, 1000, 1, 50, 700),
@ -447,6 +450,7 @@ INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id`
('EP2649247', 4, 'test', 2, 1000, 4, 50, 900), ('EP2649247', 4, 'test', 2, 1000, 4, 50, 900),
('EP2649247', 6, 'test', 2, 1000, 1, 50, NULL), ('EP2649247', 6, 'test', 2, 1000, 1, 50, NULL),
('EP2649247', 16, 'test', 1, 1000, 1, 50, NULL), ('EP2649247', 16, 'test', 1, 1000, 1, 50, NULL),
('GopiTestPO', 1, 'Test 1', 1, 10, 1, 5000, 10),
('HRT-16-72046', 1, 'Study existing designs', 1, 100, 1, 50, 30), ('HRT-16-72046', 1, 'Study existing designs', 1, 100, 1, 50, 30),
('HRT-16-72046', 2, 'Design Phase', 1, 100, 2, 100, 80), ('HRT-16-72046', 2, 'Design Phase', 1, 100, 2, 100, 80),
('HRT-16-72046', 3, 'Cost Estimation', 1, 100, 4, 100, 60), ('HRT-16-72046', 3, 'Cost Estimation', 1, 100, 4, 100, 60),
@ -498,8 +502,9 @@ DELIMITER //
CREATE DEFINER=`root`@`localhost` PROCEDURE `submit_invoice`(invNo varchar(20)) CREATE DEFINER=`root`@`localhost` PROCEDURE `submit_invoice`(invNo varchar(20))
BEGIN BEGIN
DECLARE po_no varchar(20); DECLARE po_no varchar(20);
UPDATE INVOICE SET INV_STATUS = 2 WHERE INV_NO = invNo;
SELECT PO_NUM INTO po_no FROM INVOICE WHERE INV_NO = invNo; SELECT PO_NUM INTO po_no FROM INVOICE WHERE INV_NO = invNo;
UPDATE INVOICE SET INV_NO = generate_final_inv_number(po_no), INV_STATUS = 2 WHERE INV_NO = invNo;
UPDATE PO SET INV_SEQ = INV_SEQ + 1 WHERE PO_NUM = po_no; UPDATE PO SET INV_SEQ = INV_SEQ + 1 WHERE PO_NUM = po_no;
Commit; Commit;
END// END//