diff --git a/AstuteSystem/sql/astute.sql b/AstuteSystem/sql/astute.sql index b04cd74..25641e1 100644 --- a/AstuteSystem/sql/astute.sql +++ b/AstuteSystem/sql/astute.sql @@ -99,7 +99,7 @@ CREATE TABLE IF NOT EXISTS `customer` ( PRIMARY KEY (`customer_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- Dumping data for table astute.customer: ~3 rows (approximately) +-- Dumping data for table astute.customer: ~2 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', 'test4565', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', 0, 0), @@ -210,7 +210,7 @@ DELIMITER ; -- Dumping structure for function astute.get_remaining_qty_fun DELIMITER // -CREATE DEFINER=`root`@`localhost` FUNCTION `get_remaining_qty_fun`(po_num_in varchar(20), item_no_in int) RETURNS double +CREATE DEFINER=`root`@`localhost` FUNCTION `get_remaining_qty_fun`(po_num_in varchar(40), item_no_in int) RETURNS double BEGIN DECLARE remaining_qty double; select po_detail.qty - sum(invoice_detail.qty) into remaining_qty from invoice_detail, po_detail @@ -390,6 +390,7 @@ CREATE TABLE IF NOT EXISTS `po_detail` ( `qty` double DEFAULT NULL, `service_type_id` int(1) DEFAULT '1' COMMENT '1-studies, 2-supplemental service, 3-out of pocket, 4-reimbursement, 5-', `fee` double DEFAULT NULL, + `remaining_qty` double DEFAULT NULL, PRIMARY KEY (`PO_num`,`line_item_no`), KEY `fk_PODetail_ServType` (`service_type_id`), CONSTRAINT `fk_PODetail_POnum` FOREIGN KEY (`PO_num`) REFERENCES `po` (`PO_num`), @@ -398,13 +399,13 @@ CREATE TABLE IF NOT EXISTS `po_detail` ( -- Dumping data for table astute.po_detail: ~6 rows (approximately) /*!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`) VALUES - ('EP2649247', 1, 'test', 2, 38073, 1, NULL), - ('EP2649247', 2, 'test', 2, 16345, 1, NULL), - ('EP2649247', 3, 'test', 2, 4642, 2, NULL), - ('EP2649247', 4, 'test', 2, 880, 4, NULL), - ('EP2649247', 6, 'test', 2, 456, 1, NULL), - ('EP2649247', 16, 'test', 1, 1555, 1, NULL); +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, 38073, 1, NULL, NULL), + ('EP2649247', 2, 'test', 2, 16345, 1, NULL, NULL), + ('EP2649247', 3, 'test', 2, 4642, 2, NULL, NULL), + ('EP2649247', 4, 'test', 2, 880, 4, NULL, NULL), + ('EP2649247', 6, 'test', 2, 456, 1, NULL, NULL), + ('EP2649247', 16, 'test', 1, 1555, 1, NULL, NULL); /*!40000 ALTER TABLE `po_detail` ENABLE KEYS */; -- Dumping structure for table astute.service_type