Add files via upload

This commit is contained in:
gopi17701 2018-08-23 14:09:05 -04:00 committed by GitHub
parent 4cd83d18b6
commit f1c7a94e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 14 deletions

View File

@ -110,11 +110,11 @@ public abstract class DAO {
public abstract List<InvoiceDetail> getInvoiceDetail(String invoiceNum, int lineItemNo) throws AstuteException;
public abstract void updateInvoiceMaster(String invoiceNum, java.sql.Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException;
public abstract void updateInvoiceMaster(String invoiceNum, String invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException;
public abstract void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId) throws AstuteException;
public abstract void createInvoiceMaster(String invoiceNum, java.sql.Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException;
public abstract void createInvoiceMaster(String invoiceNum, String invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException, ParseException;
public abstract void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId) throws AstuteException;

View File

@ -48,7 +48,7 @@ public class SqlDAO extends DAO {
} else if (contractNum != null && !contractNum.isEmpty()) {
sql += "WHERE UPPER(contract_num) = '" + contractNum.toUpperCase()+ "'";
} else if (PODate != null) {
sql += "WHERE PO_date = STR_TO_DATE('" + PODate + "', '%m-%d-%Y')";
sql += "WHERE PO_date = STR_TO_DATE('" + PODate + "', '%Y-%m-%d')";
} else if (astuteProjectNumber!= null && !astuteProjectNumber.isEmpty() ) {
sql += "WHERE UPPER(astute_project_num) = '" + astuteProjectNumber.toUpperCase()+ "'";
}
@ -131,7 +131,7 @@ public class SqlDAO extends DAO {
}
updateClause = updateClause + " contract_num = '" + contractNum + "',";
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%m/%d/%y')" + ",";
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%Y-%m-%d')" + ",";
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"',";
updateClause = updateClause + " title = '" + title +"'";
@ -199,8 +199,12 @@ public class SqlDAO extends DAO {
public void createPOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException, ParseException {
try {
java.util.Date date= new SimpleDateFormat("yyyy-mm-dd").parse(PODate);
java.sql.Date poDate = new java.sql.Date(date.getTime());
java.util.Date date = null;
java.sql.Date poDate = null;
if (PODate!= null && !PODate.isEmpty()) {
date = new SimpleDateFormat("yyyy-MM-dd").parse(PODate);
poDate = new java.sql.Date(date.getTime());
}
CallableStatement stmt = conn.prepareCall("{call create_PO(?,?,?,?,?,?,?)}");
stmt.setString(1, PONum);
stmt.setString(2, contractNum);
@ -315,7 +319,7 @@ public class SqlDAO extends DAO {
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
String invNo = rs.getString(1);
Date invdDate = rs.getDate(2);
String invdDate = rs.getString(2);
String PONo = rs.getString(3);
int paymentStatus = rs.getInt(4);
Double billAmt = rs.getDouble(5);
@ -373,7 +377,7 @@ public class SqlDAO extends DAO {
}
}
public void updateInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
public void updateInvoiceMaster(String invoiceNum, String invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
try {
String sql = "UPDATE INVOICE ";
String updateClause = " SET ";
@ -383,8 +387,7 @@ public class SqlDAO extends DAO {
} else {
whereClause = " WHERE UPPER(inv_no) ='" + invoiceNum.toUpperCase() + "'";
}
updateClause = updateClause + " inv_date = " + invoiceDate + ",";
updateClause = updateClause + " inv_date = STR_TO_DATE('" + invoiceDate + "', '%Y-%m-%d')" + ",";
updateClause = updateClause + " PO_num = '" + PONum + "',";
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
updateClause = updateClause + " bill_amt = " + billAmt + ",";
@ -454,13 +457,19 @@ public class SqlDAO extends DAO {
throw new AstuteException(DB_ERROR,e.getMessage());
}
}
public void createInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
public void createInvoiceMaster(String invoiceNum, String invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException, ParseException {
try {
java.util.Date date = null;
java.sql.Date invDate = null;
if (invoiceDate != null) {
date= new SimpleDateFormat("yyyy-MM-dd").parse(invoiceDate);
invDate = new java.sql.Date(date.getTime());
}
System.out.println("Calling create_invoice Procedure");
System.out.println("invoiceNum is "+invoiceNum);
CallableStatement stmt = conn.prepareCall("{call create_invoice(?,?,?,?,?,?,?,?)}");
stmt.setString(1, invoiceNum);
stmt.setDate(2, invoiceDate);
stmt.setDate(2, invDate);
stmt.setString(3, PONum);
stmt.setInt(4, pmtStatus);
stmt.setDouble(5, billAmt);
@ -501,7 +510,7 @@ public class SqlDAO extends DAO {
if (InvoiceNumber == null || InvoiceNumber.isEmpty()) {
throw new AstuteException(0, "Invoice Number should not be null!");
} else {
String sql = "UPDATE INVOICE SET INV_STATUS = 2 WHERE UPPER(INV_NO) = 'UPPER('" + InvoiceNumber + "')";
String sql = "UPDATE INVOICE SET INV_STATUS = 2 WHERE UPPER(INV_NO) = UPPER('" + InvoiceNumber + "')";
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
}
@ -516,7 +525,7 @@ public class SqlDAO extends DAO {
if (InvoiceNumber == null || InvoiceNumber.isEmpty()) {
throw new AstuteException(0, "Invoice Number should not be null!");
} else {
String sql = "UPDATE INVOICE SET INV_STATUS = 3 WHERE UPPER(INV_NO) = 'UPPER('" + InvoiceNumber + "')";
String sql = "UPDATE INVOICE SET INV_STATUS = 3 WHERE UPPER(INV_NO) = UPPER('" + InvoiceNumber + "')";
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
}