From 530735f85b1875b38d116ebbaf45901044e5cb7f Mon Sep 17 00:00:00 2001 From: Gopi Katwala Date: Sat, 8 Jun 2019 23:52:02 -0400 Subject: [PATCH] fixed a bug --- AstuteSystem/sql/astute.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AstuteSystem/sql/astute.sql b/AstuteSystem/sql/astute.sql index 794abda..a30be7b 100644 --- a/AstuteSystem/sql/astute.sql +++ b/AstuteSystem/sql/astute.sql @@ -89,7 +89,7 @@ DECLARE detailCount int; SELECT COUNT(line_item_num) INTO detailCount FROM invoice_detail where inv_num = invoiceNum; if lineItemNum is null or lineItemNum = 0 then if detailCount > 0 then - select max(lineItemNum) into maxlineItemNo from invoice_detail where inv_num = invoiceNum; + select max(lineItemNum)+1 into maxlineItemNo from invoice_detail where inv_num = invoiceNum; else set maxlineItemNo = 1; end if; @@ -121,7 +121,7 @@ SELECT COUNT(line_item_no) INTO podetailCount FROM po_detail where po_num = ponu if lineItemNo is null or lineItemNo = 0 then if podetailCount > 0 then - select max(line_item_no) into maxlineItemNo from po_detail where po_num = ponum; + select max(line_item_no)+1 into maxlineItemNo from po_detail where po_num = ponum; else SET maxlineItemNo = 1; end if;