mirror of
https://github.com/dyiop/astute.git
synced 2025-04-06 21:30:20 -04:00
466 lines
21 KiB
SQL
466 lines
21 KiB
SQL
-- --------------------------------------------------------
|
|
-- Host: 127.0.0.1
|
|
-- Server version: 5.7.12-log - MySQL Community Server (GPL)
|
|
-- Server OS: Win64
|
|
-- HeidiSQL Version: 9.4.0.5125
|
|
-- --------------------------------------------------------
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET NAMES utf8 */;
|
|
/*!50503 SET NAMES utf8mb4 */;
|
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
|
|
|
|
-- Dumping database structure for astute
|
|
DROP DATABASE IF EXISTS `astute`;
|
|
CREATE DATABASE IF NOT EXISTS `astute` /*!40100 DEFAULT CHARACTER SET utf8 */;
|
|
USE `astute`;
|
|
|
|
-- Dumping structure for table astute.change_order
|
|
CREATE TABLE IF NOT EXISTS `change_order` (
|
|
`PO_num` varchar(20) NOT NULL,
|
|
`change_order_num` int(20) NOT NULL,
|
|
`change_order_date` date DEFAULT NULL,
|
|
`change_order_amt` double NOT NULL,
|
|
`description` varchar(500) DEFAULT NULL,
|
|
PRIMARY KEY (`PO_num`,`change_order_num`),
|
|
CONSTRAINT `fk_PO_CO_POnum` FOREIGN KEY (`PO_num`) REFERENCES `po` (`PO_num`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.change_order: ~0 rows (approximately)
|
|
/*!40000 ALTER TABLE `change_order` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `change_order` ENABLE KEYS */;
|
|
|
|
-- 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)
|
|
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);
|
|
SELECT LAST_INSERT_ID() into last_inserted_id;
|
|
return last_inserted_id;
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for procedure astute.create_invoice
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `create_invoice`(invNo varchar(20),invDate date,PONo varchar(20),changeOrderNum varchar(20),paymentStatus int,billAmt double,specialNotes varchar(500), certClause Varchar(500),pmtReceivedDate date)
|
|
BEGIN
|
|
INSERT INTO invoice (inv_no,inv_date,PO_num,change_order_num,pmt_status,bill_amt,special_notes,certifcation,pmt_received_date)
|
|
VALUES (invNo, invDate, PONo, changeOrderNum, paymentStatus, billAmt, specialNotes, certClause, pmtReceivedDate);
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for procedure astute.create_invoice_detail
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `create_invoice_detail`(invoiceNum varchar(20), lineItemNum int, POLineItemNum varchar(20), serviceTypeId int, description varchar(500), qty_in double, fee_in double)
|
|
BEGIN
|
|
INSERT INTO INVOICE_DETAIL (inv_num, line_item_num, PO_line_item_num, service_type_id, description, qty, fee)
|
|
VALUES (invoiceNum, lineItemNum, POLineItemNum, serviceTypeId, description, qty_in, fee_in);
|
|
END//
|
|
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))
|
|
BEGIN
|
|
INSERT INTO PO (PO_num, contract_num, PO_date, contract_amt, customer_id,astute_project_num)
|
|
VALUES (PONum, contractNum, PODate, contractAmt, customerId,astute_project_num_in);
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for procedure astute.create_po_detail
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `create_po_detail`(PONum varchar(40), lineItemNo int, servicedesc varchar(500), feetypeid int(11), quantity double, fee_in double, servicetypeid int(1))
|
|
BEGIN
|
|
INSERT INTO PO_DETAIL (PO_num,line_item_no,service_desc,fee_type_id,qty,fee,service_type_id)
|
|
VALUES (POnum,lineitemno,servicedesc,feetypeid,quantity,fee_in, servicetypeid);
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for table astute.customer
|
|
CREATE TABLE IF NOT EXISTS `customer` (
|
|
`customer_id` int(5) NOT NULL AUTO_INCREMENT,
|
|
`customer_name` varchar(100) DEFAULT NULL,
|
|
`bill_to_dept` varchar(50) DEFAULT NULL,
|
|
`add1` varchar(50) DEFAULT NULL,
|
|
`add2` varchar(50) DEFAULT NULL,
|
|
`city` varchar(50) DEFAULT NULL,
|
|
`state` varchar(2) DEFAULT NULL,
|
|
`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,
|
|
PRIMARY KEY (`customer_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- 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, 'test1233', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', 0, 0),
|
|
(2, 'test123', 'test123', 'test123', NULL, 'test123', 'md', 20874, 0, NULL, 0, 0);
|
|
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for function astute.duplicate_invoice
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` FUNCTION `duplicate_invoice`(inv_no_in varchar(20)) RETURNS varchar(20) CHARSET utf8
|
|
BEGIN
|
|
DECLARE generated_inv_number varchar(20);
|
|
DECLARE po_num_in varchar(20);
|
|
|
|
SELECT po_num
|
|
INTO po_num_in
|
|
FROM invoice
|
|
WHERE inv_no = inv_no_in;
|
|
|
|
SELECT generate_inv_number(po_num_in)
|
|
INTO generated_inv_number;
|
|
|
|
INSERT INTO invoice
|
|
(inv_no,inv_date,PO_num,change_order_num,bill_amt,special_notes,certification,inv_status,pmt_status)
|
|
(SELECT generated_inv_number, inv_date, PO_num, change_order_num, bill_amt, special_notes, certification, inv_status, pmt_status
|
|
FROM invoice
|
|
WHERE inv_no = inv_no_in);
|
|
|
|
INSERT INTO invoice_detail
|
|
(inv_num,line_item_num,PO_line_item_num,service_type_id,description,qty,fee,fee_type_id)
|
|
(SELECT generated_inv_number, line_item_num, PO_line_item_num, service_type_id, description, qty, fee, fee_type_id
|
|
FROM invoice_detail
|
|
WHERE inv_num = inv_no_in);
|
|
|
|
return generated_inv_number;
|
|
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for table astute.fee_type
|
|
CREATE TABLE IF NOT EXISTS `fee_type` (
|
|
`fee_type_id` int(11) NOT NULL,
|
|
`fee_type_desc` varchar(40) NOT NULL,
|
|
PRIMARY KEY (`fee_type_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.fee_type: ~2 rows (approximately)
|
|
/*!40000 ALTER TABLE `fee_type` DISABLE KEYS */;
|
|
INSERT INTO `fee_type` (`fee_type_id`, `fee_type_desc`) VALUES
|
|
(1, 'Fixed fee'),
|
|
(2, 'Hourly');
|
|
/*!40000 ALTER TABLE `fee_type` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for function astute.generate_inv_number
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` FUNCTION `generate_inv_number`(po_num_in varchar(20)) RETURNS varchar(20) CHARSET utf8
|
|
BEGIN
|
|
DECLARE customer_id_in int;
|
|
DECLARE customer_code varchar(4);
|
|
DECLARE po_count int;
|
|
DECLARE inv_count int;
|
|
DECLARE inv_number varchar(20);
|
|
|
|
SELECT customer_id
|
|
INTO customer_id_in
|
|
FROM po
|
|
WHERE po.po_num = po_num_in;
|
|
|
|
SELECT substr(customer.customer_name, 1, 4)
|
|
INTO customer_code
|
|
FROM customer
|
|
WHERE customer_id = customer_id_in;
|
|
|
|
SELECT count(*)
|
|
INTO po_count
|
|
FROM po
|
|
WHERE customer_id = customer_id_in;
|
|
|
|
SELECT count(*)
|
|
INTO inv_count
|
|
FROM invoice
|
|
WHERE invoice.PO_num in (SELECT po_num FROM po WHERE po.customer_id = customer_id_in);
|
|
SELECT concat(customer_code, '-',LPAD(po_count, 2, '0'), '_',date_format(now(),'%y'), date_format(now(),'%m'), '_', LPAD(inv_count, 2, '0')) INTO inv_number;
|
|
RETURN inv_number;
|
|
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for function astute.get_payment_type
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` FUNCTION `get_payment_type`(pmt_type int) RETURNS varchar(20) CHARSET utf8
|
|
BEGIN
|
|
declare payment_type VARCHAR(20);
|
|
SELECT payment_type_name INTO payment_type FROM payment_type WHERE payment_type_id = pmt_type;
|
|
return payment_type;
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for function astute.get_previously_billed_amt
|
|
DELIMITER //
|
|
CREATE DEFINER=`root`@`localhost` FUNCTION `get_previously_billed_amt`(po_no varchar(20)) RETURNS double(10,2)
|
|
BEGIN
|
|
declare billed_amt double(10,2);
|
|
SELECT sum(bill_amt) INTO billed_amt FROM invoice WHERE invoice.PO_num = po_no;
|
|
return billed_amt;
|
|
END//
|
|
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
|
|
BEGIN
|
|
DECLARE remaining_qty double;
|
|
select po_detail.qty - sum(invoice_detail.qty) into remaining_qty from invoice_detail, po_detail
|
|
where invoice_detail.inv_num in (select inv_num from invoice where invoice.PO_num = po_num_in)
|
|
and invoice_detail.line_item_num = item_no_in
|
|
and invoice_detail.line_item_num = po_detail.line_item_no;
|
|
return remaining_qty;
|
|
END//
|
|
DELIMITER ;
|
|
|
|
-- Dumping structure for table astute.invoice
|
|
CREATE TABLE IF NOT EXISTS `invoice` (
|
|
`inv_no` varchar(20) NOT NULL,
|
|
`inv_date` date NOT NULL,
|
|
`PO_num` varchar(40) NOT NULL,
|
|
`change_order_num` varchar(20) DEFAULT NULL,
|
|
`bill_amt` double NOT NULL,
|
|
`special_notes` varchar(500) DEFAULT NULL,
|
|
`certification` varchar(500) DEFAULT 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned.',
|
|
`inv_status` int(2) DEFAULT '1',
|
|
`pmt_status` int(11) NOT NULL DEFAULT '1',
|
|
PRIMARY KEY (`inv_no`),
|
|
KEY `fk_InvMaster_POnum` (`PO_num`),
|
|
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)
|
|
/*!40000 ALTER TABLE `invoice` DISABLE KEYS */;
|
|
INSERT INTO `invoice` (`inv_no`, `inv_date`, `PO_num`, `change_order_num`, `bill_amt`, `special_notes`, `certification`, `inv_status`, `pmt_status`) VALUES
|
|
('123', '2018-01-01', 'EP2649247', 'test', 5000, 'asdf', 'Certified that the above items and rates are in accordance with the contractual agreement as verified by the undersigned.', 1, 1),
|
|
('NVCC-01_1712_21', '2017-12-28', 'EP2649247', NULL, 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),
|
|
('test-04_1807_02', '2017-12-28', 'EP2649247', NULL, 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);
|
|
/*!40000 ALTER TABLE `invoice` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.invoice_detail
|
|
CREATE TABLE IF NOT EXISTS `invoice_detail` (
|
|
`inv_num` varchar(20) NOT NULL,
|
|
`line_item_num` int(11) NOT NULL,
|
|
`PO_line_item_num` int(11) DEFAULT NULL,
|
|
`service_type_id` int(11) DEFAULT NULL,
|
|
`description` varchar(500) DEFAULT NULL,
|
|
`qty` double DEFAULT NULL,
|
|
`fee` double DEFAULT NULL,
|
|
`fee_type_id` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`inv_num`,`line_item_num`),
|
|
KEY `fk_InvDetail_FeeType` (`fee_type_id`),
|
|
CONSTRAINT `fk_InvDetail_FeeType` FOREIGN KEY (`fee_type_id`) REFERENCES `fee_type` (`fee_type_id`),
|
|
CONSTRAINT `fk_InvDetail_InvNum` FOREIGN KEY (`inv_num`) REFERENCES `invoice` (`inv_no`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.invoice_detail: ~13 rows (approximately)
|
|
/*!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
|
|
('123', 1, NULL, 1, 'tese', 34543, 345435, 1),
|
|
('NVCC-01_1712_21', 1, 1, NULL, 'test', NULL, 14953, 1),
|
|
('NVCC-01_1712_21', 2, 3, NULL, 'Additional Services: Third Party Utility Verification', NULL, 1500, 1),
|
|
('NVCC-01_1712_21', 3, 3, NULL, 'Additional Services: Field Investigatoin Travel', NULL, 321, 1),
|
|
('NVCC-01_1712_21', 4, 4, NULL, 'Reimbursable Expense: Printing and parking', NULL, 80, 1),
|
|
('NVCC-01_1712_21', 10, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1),
|
|
('NVCC-01_1712_21', 11, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1),
|
|
('test-04_1807_02', 1, 1, NULL, 'test', NULL, 14953, 1),
|
|
('test-04_1807_02', 2, 3, NULL, 'Additional Services: Third Party Utility Verification', NULL, 1500, 1),
|
|
('test-04_1807_02', 3, 3, NULL, 'Additional Services: Field Investigatoin Travel', NULL, 321, 1),
|
|
('test-04_1807_02', 4, 4, NULL, 'Reimbursable Expense: Printing and parking', NULL, 80, 1),
|
|
('test-04_1807_02', 10, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1),
|
|
('test-04_1807_02', 11, 1, 0, 'Design Phase Service _Prelimanary', 0, 14953, 1);
|
|
/*!40000 ALTER TABLE `invoice_detail` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.invoice_notes
|
|
CREATE TABLE IF NOT EXISTS `invoice_notes` (
|
|
`inv_no` varchar(20) NOT NULL,
|
|
`inv_note` varchar(500) NOT NULL,
|
|
PRIMARY KEY (`inv_no`),
|
|
CONSTRAINT `fk_inv_notes_inv_no` FOREIGN KEY (`inv_no`) REFERENCES `invoice` (`inv_no`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.invoice_notes: ~0 rows (approximately)
|
|
/*!40000 ALTER TABLE `invoice_notes` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `invoice_notes` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.invoice_payment
|
|
CREATE TABLE IF NOT EXISTS `invoice_payment` (
|
|
`inv_no` varchar(20) NOT NULL,
|
|
`invoice_payment_type` int(11) NOT NULL,
|
|
`invoice_amount` double NOT NULL,
|
|
`payment_date` date NOT NULL,
|
|
`invoice_payment_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`description` varchar(50) DEFAULT NULL,
|
|
PRIMARY KEY (`invoice_payment_id`),
|
|
KEY `fk_inv_pmt_inv_no` (`inv_no`),
|
|
KEY `fk_pinv_pmt_type` (`invoice_payment_type`),
|
|
CONSTRAINT `fk_inv_pmt_inv_no` FOREIGN KEY (`inv_no`) REFERENCES `invoice` (`inv_no`),
|
|
CONSTRAINT `fk_pinv_pmt_type` FOREIGN KEY (`invoice_payment_type`) REFERENCES `payment_type` (`payment_type_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.invoice_payment: ~0 rows (approximately)
|
|
/*!40000 ALTER TABLE `invoice_payment` DISABLE KEYS */;
|
|
/*!40000 ALTER TABLE `invoice_payment` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.invoice_status
|
|
CREATE TABLE IF NOT EXISTS `invoice_status` (
|
|
`inv_status_id` int(11) NOT NULL,
|
|
`inv_status_desc` varchar(20) NOT NULL,
|
|
PRIMARY KEY (`inv_status_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.invoice_status: ~3 rows (approximately)
|
|
/*!40000 ALTER TABLE `invoice_status` DISABLE KEYS */;
|
|
INSERT INTO `invoice_status` (`inv_status_id`, `inv_status_desc`) VALUES
|
|
(1, 'Draft'),
|
|
(2, 'Submitted'),
|
|
(3, 'Void');
|
|
/*!40000 ALTER TABLE `invoice_status` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.payment_status
|
|
CREATE TABLE IF NOT EXISTS `payment_status` (
|
|
`payment_status_id` int(11) NOT NULL,
|
|
`payment_status_desc` varchar(20) NOT NULL,
|
|
PRIMARY KEY (`payment_status_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.payment_status: ~3 rows (approximately)
|
|
/*!40000 ALTER TABLE `payment_status` DISABLE KEYS */;
|
|
INSERT INTO `payment_status` (`payment_status_id`, `payment_status_desc`) VALUES
|
|
(1, 'Outstanding'),
|
|
(2, 'Partially paid'),
|
|
(3, 'Paid');
|
|
/*!40000 ALTER TABLE `payment_status` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.payment_type
|
|
CREATE TABLE IF NOT EXISTS `payment_type` (
|
|
`payment_type_id` int(11) NOT NULL,
|
|
`payment_type_name` varchar(20) NOT NULL,
|
|
PRIMARY KEY (`payment_type_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.payment_type: ~3 rows (approximately)
|
|
/*!40000 ALTER TABLE `payment_type` DISABLE KEYS */;
|
|
INSERT INTO `payment_type` (`payment_type_id`, `payment_type_name`) VALUES
|
|
(1, 'Credit Card'),
|
|
(2, 'Check'),
|
|
(3, 'ACH');
|
|
/*!40000 ALTER TABLE `payment_type` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.po
|
|
CREATE TABLE IF NOT EXISTS `po` (
|
|
`PO_num` varchar(40) NOT NULL COMMENT 'Alpha numeric, auto generated in frontend',
|
|
`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,
|
|
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`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.po: ~4 rows (approximately)
|
|
/*!40000 ALTER TABLE `po` DISABLE KEYS */;
|
|
INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`) VALUES
|
|
('EP2649247', 'TEST123', '2017-10-13', 30000.00, 1, NULL),
|
|
('test12', 'test', NULL, 60000.00, 1, NULL),
|
|
('test3', 'test', NULL, 60000.00, 1, NULL),
|
|
('test5', 'test', NULL, 60000.00, 1, NULL);
|
|
/*!40000 ALTER TABLE `po` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.po_detail
|
|
CREATE TABLE IF NOT EXISTS `po_detail` (
|
|
`PO_num` varchar(40) NOT NULL,
|
|
`line_item_no` int(11) NOT NULL,
|
|
`service_desc` varchar(500) DEFAULT NULL,
|
|
`fee_type_id` int(11) DEFAULT '1' COMMENT '1-fixed fee, 2-hourly',
|
|
`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,
|
|
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`),
|
|
CONSTRAINT `fk_PODetail_ServType` FOREIGN KEY (`service_type_id`) REFERENCES `service_type` (`service_type_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- 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);
|
|
/*!40000 ALTER TABLE `po_detail` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.service_type
|
|
CREATE TABLE IF NOT EXISTS `service_type` (
|
|
`service_type_id` int(11) NOT NULL,
|
|
`desc` varchar(40) NOT NULL,
|
|
PRIMARY KEY (`service_type_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.service_type: ~5 rows (approximately)
|
|
/*!40000 ALTER TABLE `service_type` DISABLE KEYS */;
|
|
INSERT INTO `service_type` (`service_type_id`, `desc`) VALUES
|
|
(1, 'study'),
|
|
(2, 'design'),
|
|
(3, 'Peer review'),
|
|
(4, 'cost estimation'),
|
|
(5, 'forensic investigation');
|
|
/*!40000 ALTER TABLE `service_type` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.session
|
|
CREATE TABLE IF NOT EXISTS `session` (
|
|
`session_id` varchar(500) NOT NULL,
|
|
`user_id` int(11) NOT NULL,
|
|
`session_start_date` date DEFAULT NULL,
|
|
`session_end_date` date DEFAULT NULL,
|
|
PRIMARY KEY (`session_id`),
|
|
KEY `fk_session_user_id` (`user_id`),
|
|
CONSTRAINT `fk_session_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.session: ~3 rows (approximately)
|
|
/*!40000 ALTER TABLE `session` DISABLE KEYS */;
|
|
INSERT INTO `session` (`session_id`, `user_id`, `session_start_date`, `session_end_date`) VALUES
|
|
('745de7a0e6c1480398ca36116512bc06', 1, NULL, NULL),
|
|
('985874e08cb74fa08419f8883f3eeff7', 1, NULL, NULL),
|
|
('a4b6bde153004b7ba17220f5ba2bb323', 1, NULL, NULL);
|
|
/*!40000 ALTER TABLE `session` ENABLE KEYS */;
|
|
|
|
-- Dumping structure for table astute.user
|
|
CREATE TABLE IF NOT EXISTS `user` (
|
|
`user_id` int(5) NOT NULL,
|
|
`username` varchar(20) DEFAULT NULL,
|
|
`password` varchar(20) DEFAULT NULL,
|
|
`first_name` varchar(20) DEFAULT NULL,
|
|
`middle_name` varchar(20) DEFAULT NULL,
|
|
`last_name` varchar(20) DEFAULT NULL,
|
|
`role` varchar(20) DEFAULT NULL,
|
|
`email` varchar(40) DEFAULT NULL,
|
|
`office_phone_ext` int(3) DEFAULT NULL,
|
|
`cell_phone` bigint(20) DEFAULT NULL,
|
|
PRIMARY KEY (`user_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- Dumping data for table astute.user: ~2 rows (approximately)
|
|
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
|
|
INSERT INTO `user` (`user_id`, `username`, `password`, `first_name`, `middle_name`, `last_name`, `role`, `email`, `office_phone_ext`, `cell_phone`) VALUES
|
|
(1, 'sparikh', 'sparikh', 'Saurin', NULL, 'Parikh', 'Owner', 'sparikh@Astuteng.com', 2024002004, 3014616485),
|
|
(2, 'humarethiya', 'humarethiya', 'Haresh', NULL, 'Umaretiya', 'Owner', 'Humaretiya@astuteng.com', 2024002004, 0);
|
|
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
|
|
|
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
|
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|