fixed a bug

This commit is contained in:
Gopi Katwala 2019-06-08 23:52:02 -04:00
parent bcebd483f5
commit 530735f85b

View File

@ -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;