From 6492092cbc8277c7f5f76639ba481313b26a5c6e Mon Sep 17 00:00:00 2001 From: Gopi Katwala Date: Wed, 17 Jul 2019 08:05:27 -0400 Subject: [PATCH] * fixed the issue with submit invoice - added a new column - submitted_invoice_date_time * Fixed deletePoDetail Method * Fixed deleteInvoiceDetail method --- AstuteSystem/sql/astute.sql | 4 +++- AstuteSystem/src/main/java/com/astute/dao/SqlDAO.java | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/AstuteSystem/sql/astute.sql b/AstuteSystem/sql/astute.sql index 2b7aa27..fb27a69 100644 --- a/AstuteSystem/sql/astute.sql +++ b/AstuteSystem/sql/astute.sql @@ -422,7 +422,7 @@ END; DELIMITER ; -- Dumping structure for table astute.invoice -CREATE TABLE IF NOT EXISTS `invoice` ( +CREATE TABLE `invoice` ( `inv_no` varchar(20) NOT NULL, `inv_date` date NOT NULL, `PO_num` varchar(40) NOT NULL, @@ -431,11 +431,13 @@ CREATE TABLE IF NOT EXISTS `invoice` ( `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', + `submitted_date_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, 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: ~3 rows (approximately) /*!40000 ALTER TABLE `invoice` DISABLE KEYS */; INSERT INTO `invoice` (`inv_no`, `inv_date`, `PO_num`, `bill_amt`, `special_notes`, `certification`, `inv_status`, `pmt_status`) VALUES diff --git a/AstuteSystem/src/main/java/com/astute/dao/SqlDAO.java b/AstuteSystem/src/main/java/com/astute/dao/SqlDAO.java index bb422f8..39d9aff 100644 --- a/AstuteSystem/src/main/java/com/astute/dao/SqlDAO.java +++ b/AstuteSystem/src/main/java/com/astute/dao/SqlDAO.java @@ -243,7 +243,7 @@ public class SqlDAO extends DAO { public void deletePODetail(String POnum, int lineItemNo) throws AstuteException { try { - if (!isPOFinalized(POnum)) { + if (isPOFinalized(POnum)) { throw new AstuteException(0, "PO " + POnum + " is already finalyzed and can not be changed."); } if (POnum == null || POnum.isEmpty() || lineItemNo <= 0) { @@ -255,7 +255,7 @@ public class SqlDAO extends DAO { System.out.println(sql); Statement stmt = conn.createStatement(); stmt.executeUpdate(sql); - updateRemainingQty(POnum,null, lineItemNo); +// updateRemainingQty(POnum,null, lineItemNo); updateContractAmount(POnum); } catch (SQLException e) { e.printStackTrace(); @@ -718,7 +718,7 @@ public class SqlDAO extends DAO { System.out.println(sql); Statement stmt = conn.createStatement(); stmt.executeUpdate(sql); - updateRemainingQty("",invoiceNum, POLineItemNum); +// updateRemainingQty("",invoiceNum, POLineItemNum); } catch (SQLException e) { e.printStackTrace(); throw new AstuteException(DB_ERROR,e.getMessage()); @@ -735,10 +735,11 @@ public class SqlDAO extends DAO { } else { whereClause = " WHERE UPPER(inv_num) = '" + invoiceNum.toUpperCase() + "' AND line_item_num = " + lineItemNum; } + sql += whereClause; System.out.println(sql); Statement stmt = conn.createStatement(); stmt.executeUpdate(sql); - updateAllRemainingQuantities(invoiceNum); +// updateAllRemainingQuantities(invoiceNum); } catch (SQLException e) { e.printStackTrace(); throw new AstuteException(DB_ERROR,e.getMessage()); @@ -788,7 +789,7 @@ public class SqlDAO extends DAO { stmt.executeUpdate(); System.out.println("invoiceNum is " + invoiceNum); System.out.println("POLineItemNum is " + POLineItemNum); - updateRemainingQty(null,invoiceNum, POLineItemNum); +// updateRemainingQty(null,invoiceNum, POLineItemNum); } catch (SQLException e) { e.printStackTrace(); throw new AstuteException(DB_ERROR,e.getMessage());