From c27ef42baf18d2ca31ee7c242816f7a009389c86 Mon Sep 17 00:00:00 2001 From: gopi17701 <41270090+gopi17701@users.noreply.github.com> Date: Tue, 31 Jul 2018 15:55:13 -0400 Subject: [PATCH] Add files via upload --- AstuteSystem/sql/astute.sql | 42 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/AstuteSystem/sql/astute.sql b/AstuteSystem/sql/astute.sql index 6329444..b04cd74 100644 --- a/AstuteSystem/sql/astute.sql +++ b/AstuteSystem/sql/astute.sql @@ -34,11 +34,11 @@ CREATE TABLE IF NOT EXISTS `change_order` ( -- Dumping structure for function astute.create_customer_fun DELIMITER // -CREATE DEFINER=`root`@`localhost` FUNCTION `create_customer_fun`(customerName varchar(100), billToDept varchar(100), add1In varchar(100), add2In varchar(100), cityIn varchar(50), stateIn varchar(20), zipIn int(5), zipLast4In int(4), emailIn varchar(50), phoneIn int(10), faxIn int(10)) RETURNS int(11) +CREATE DEFINER=`root`@`localhost` FUNCTION `create_customer_fun`(customerid varchar(20), customerName varchar(100), billToDept varchar(100), add1In varchar(100), add2In varchar(100), cityIn varchar(50), stateIn varchar(20), zipIn int(5), zipLast4In int(4), emailIn varchar(50), phoneIn int(10), faxIn int(10)) RETURNS varchar(20) CHARSET utf8 BEGIN -DECLARE last_inserted_id int(11); -INSERT INTO customer (customer_name, bill_to_dept, add1, add2, city, state ,zip, zip_last_4, email, phone, fax) -VALUES (customerName, billToDept, add1In, add2In, cityIn, stateIn, zipIn, ziplast4In, emailIn, phoneIn, faxIn); +DECLARE last_inserted_id varchar(20); +INSERT INTO customer (customer_id, customer_name, bill_to_dept, add1, add2, city, state ,zip, zip_last_4, email, phone, fax) +VALUES (customerid, customerName, billToDept, add1In, add2In, cityIn, stateIn, zipIn, ziplast4In, emailIn, phoneIn, faxIn); SELECT LAST_INSERT_ID() into last_inserted_id; return last_inserted_id; END// @@ -64,7 +64,7 @@ DELIMITER ; -- Dumping structure for procedure astute.create_po DELIMITER // -CREATE DEFINER=`root`@`localhost` PROCEDURE `create_po`(PONum varchar(40), contractNum varchar(20), PODate date, contractAmt double(10,2), customerid int, astute_project_num_in varchar(20)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `create_po`(PONum varchar(40), contractNum varchar(20), PODate date, contractAmt double(10,2), customerid varchar(20), astute_project_num_in varchar(20)) BEGIN DECLARE next_po_id int(11); SELECT count(*) + 1 INTO next_po_id FROM PO WHERE customer_id = customerid; @@ -84,7 +84,7 @@ DELIMITER ; -- Dumping structure for table astute.customer CREATE TABLE IF NOT EXISTS `customer` ( - `customer_id` int(5) NOT NULL AUTO_INCREMENT, + `customer_id` varchar(10) NOT NULL, `customer_name` varchar(100) DEFAULT NULL, `bill_to_dept` varchar(50) DEFAULT NULL, `add1` varchar(50) DEFAULT NULL, @@ -94,16 +94,17 @@ CREATE TABLE IF NOT EXISTS `customer` ( `zip` int(5) DEFAULT NULL, `zip_last_4` int(4) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, - `phone` bigint(11) DEFAULT NULL, - `fax` int(10) DEFAULT NULL, + `phone` bigint(15) DEFAULT NULL, + `fax` bigint(15) DEFAULT NULL, PRIMARY KEY (`customer_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- Dumping data for table astute.customer: ~2 rows (approximately) +-- Dumping data for table astute.customer: ~3 rows (approximately) /*!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 - (1, 'test1233', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', 0, 0), - (2, 'test123', 'test123', 'test123', NULL, 'test123', 'md', 20874, 0, NULL, 0, 0); + ('1', 'test4565', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', 0, 0), + ('2', 'test123', 'test123', 'test123', NULL, 'test123', 'md', 20874, 0, NULL, 0, 0), + ('test500', 'test500', 'test500', 'test500', 'test500', 'test500', 'md', 20874, 1234, 'Test@Test.com', 1231231233, 131231233); /*!40000 ALTER TABLE `customer` ENABLE KEYS */; -- Dumping structure for function astute.duplicate_invoice @@ -235,7 +236,7 @@ CREATE TABLE IF NOT EXISTS `invoice` ( CONSTRAINT `fk_InvMaster_POnum` FOREIGN KEY (`PO_num`) REFERENCES `po` (`PO_num`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- Dumping data for table astute.invoice: ~4 rows (approximately) +-- Dumping data for table astute.invoice: ~3 rows (approximately) /*!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 ('123', '2018-01-01', 'EP2649247', 5000, 'asdf', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned.', 1, 1), @@ -360,23 +361,24 @@ CREATE TABLE IF NOT EXISTS `po` ( `contract_num` varchar(20) DEFAULT NULL, `PO_date` date DEFAULT NULL, `contract_amt` double(10,2) DEFAULT NULL, - `customer_id` int(11) NOT NULL, - `astute_project_num` varchar(20) DEFAULT NULL, + `customer_id` varchar(11) NOT NULL, + `astute_project_num` varchar(20) NOT NULL, `po_id` int(11) NOT NULL, PRIMARY KEY (`PO_num`), KEY `ind_pomaster_contractno` (`contract_num`), KEY `ind_pomaster_podate` (`PO_date`), KEY `po_customer_id` (`customer_id`), - CONSTRAINT `po_customer_id` 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; --- Dumping data for table astute.po: ~4 rows (approximately) +-- Dumping data for table astute.po: ~5 rows (approximately) /*!40000 ALTER TABLE `po` DISABLE KEYS */; INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`, `po_id`) VALUES - ('EP2649247', 'test123', '2018-07-10', 5000.00, 1, 'adf', 1), - ('test12', 'test', '2018-07-11', 60000.00, 1, NULL, 2), - ('test3', 'test', '2018-07-12', 60000.00, 1, NULL, 3), - ('test5', 'test', '2018-07-13', 60000.00, 1, NULL, 4); + ('EP2649247', 'test123', NULL, 30000.00, '1', 'null', 1), + ('test12', 'test', '2018-07-11', 60000.00, '1', 'adf', 2), + ('test3', 'test', '2018-07-12', 60000.00, '1', 'adf', 3), + ('test5', 'test', '2018-07-13', 60000.00, '1', 'adf', 4), + ('test500', 'test', NULL, 60000.00, 'Test500', 'test', 1); /*!40000 ALTER TABLE `po` ENABLE KEYS */; -- Dumping structure for table astute.po_detail