From f10e3f323a227cae61f66ca11a807c5cd7841b94 Mon Sep 17 00:00:00 2001 From: gopi17701 <41270090+gopi17701@users.noreply.github.com> Date: Thu, 23 Aug 2018 20:28:59 -0400 Subject: [PATCH] Add files via upload --- AstuteSystem/sql/astute.sql | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/AstuteSystem/sql/astute.sql b/AstuteSystem/sql/astute.sql index 2836f4e..4bb9526 100644 --- a/AstuteSystem/sql/astute.sql +++ b/AstuteSystem/sql/astute.sql @@ -125,13 +125,13 @@ BEGIN 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 + (SELECT generated_inv_number, CURDATE(), 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 + (SELECT generated_inv_number, line_item_num, PO_line_item_num, service_type_id, description, 0, fee, fee_type_id FROM invoice_detail WHERE inv_num = inv_no_in); @@ -393,7 +393,7 @@ CREATE TABLE IF NOT EXISTS `po_detail` ( 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: ~11 rows (approximately) +-- Dumping data for table astute.po_detail: ~14 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`, `remaining_qty`) VALUES ('EP2649247', 1, 'test', 2, 38073, 1, NULL, NULL), @@ -402,6 +402,9 @@ INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id` ('EP2649247', 4, 'test', 2, 880, 4, NULL, NULL), ('EP2649247', 6, 'test', 2, 456, 1, NULL, NULL), ('EP2649247', 16, 'test', 1, 1555, 1, NULL, NULL), + ('HRT-16-72046', 1, 'Study existing designs', 1, 100, 1, 50, 100), + ('HRT-16-72046', 2, 'Design Phase', 1, 100, 2, 100, 100), + ('HRT-16-72046', 3, 'Cost Estimation', 1, 100, 4, 100, 100), ('Real PO 123', 1, 'Real PO 123 lineitem1', 1, 10000, 1, 500, NULL), ('Real PO 123', 2, 'Real PO 123 - lineitem 2', 1, 1000, 1, 50, 1000), ('Real PO 123', 3, 'Real PO 123 - lineitem 3', 1, 1000, 1, 50, 1000), @@ -457,9 +460,9 @@ else set po_no = po_no_in; end if; -select po_detail.qty - sum(invoice_detail.qty) into rem_qty from invoice_detail, invoice, po_detail -where invoice_detail.inv_num in (select inv_num from invoice where invoice.PO_num = po_no) -and invoice_detail.po_line_item_num = inv_num_in +select po_detail.qty - ifnull(sum(invoice_detail.qty),0) into rem_qty from invoice_detail, invoice, po_detail +where invoice_detail.inv_num in (select inv_no from invoice where invoice.PO_num = po_no) +and invoice_detail.po_line_item_num = item_no_in and po_detail.PO_num = po_no and invoice.PO_num = po_detail.PO_num and invoice.inv_no = invoice_detail.inv_num