From 9f1211e916f2078114966dc94698290c2c2a6a21 Mon Sep 17 00:00:00 2001 From: Gopi Katwala Date: Sat, 8 Jun 2019 19:35:01 -0400 Subject: [PATCH] Session login and logout fixes --- AstuteSystem/sql/astute.sql | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/AstuteSystem/sql/astute.sql b/AstuteSystem/sql/astute.sql index 02f6c85..964d86d 100644 --- a/AstuteSystem/sql/astute.sql +++ b/AstuteSystem/sql/astute.sql @@ -90,14 +90,18 @@ VALUES (next_po_id, PONum, contractNum, PODate, contractAmt, customerId,astute_p 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), remaining_qty double) +DROP PROCEDURE IF EXISTS astute.create_po_detail; +CREATE PROCEDURE astute.`create_po_detail`(PONum varchar(40), lineItemNo int, servicedesc varchar(500), feetypeid int(11), quantity double, fee_in double, servicetypeid int(1), remaining_qty double) BEGIN +declare maxlineItemNo int; +if lineItemNo is null or lineItemNo = 0 then + select max(lineItemNo) into maxlineItemNo from po_detail where po_num = ponum; +else + set maxlineItemNo = lineItemNo; +end if; INSERT INTO PO_DETAIL (PO_num,line_item_no,service_desc,fee_type_id,qty,fee,service_type_id, remaining_qty) -VALUES (POnum,lineitemno,servicedesc,feetypeid,quantity,fee_in, servicetypeid, remaining_qty); -END// -DELIMITER ; +VALUES (POnum,maxlineItemNo,servicedesc,feetypeid,quantity,fee_in, servicetypeid, remaining_qty); +END; -- Dumping structure for table astute.customer CREATE TABLE IF NOT EXISTS `customer` (