Add files via upload

This commit is contained in:
gopi17701 2018-07-24 22:06:45 -04:00 committed by GitHub
parent bfc6238a8f
commit 7ff04150a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 46 deletions

View File

@ -109,11 +109,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, String changeOrderNum, int pmtStatus, Double billAmt, String specialNotes, String certification) 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 updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee) throws AstuteException;
public abstract void createInvoiceMaster(String invoiceNum, java.sql.Date invoiceDate, String PONum, String changeOrderNum, int pmtStatus, Double billAmt, String specialNotes, String certification) 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 createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee) throws AstuteException;

View File

@ -276,7 +276,7 @@ public class SqlDAO extends DAO {
Statement stmt = conn.createStatement();
String whereClause = " WHERE ";
boolean whereClauseIndicator = false;
String sql = "SELECT inv_no, inv_date, PO_num, change_order_num, pmt_status, bill_amt, special_notes, certification FROM INVOICE ";
String sql = "SELECT inv_no, inv_date, PO_num, pmt_status, bill_amt, special_notes, certification, inv_status FROM INVOICE ";
if (invoiceNumber != null && !invoiceNumber.isEmpty()) {
whereClause = whereClause + " UPPER(inv_no) = '"+ invoiceNumber.toUpperCase() +"'";
whereClauseIndicator = true;
@ -297,12 +297,13 @@ public class SqlDAO extends DAO {
String invNo = rs.getString(1);
Date invdDate = rs.getDate(2);
String PONo = rs.getString(3);
String changeOrderNum = rs.getString(4);
int paymentStatus = rs.getInt(5);
Double billAmt = rs.getDouble(6);
String specialNotes = rs.getString(7);
String certification = rs.getString(8);
Invoice invoice = new Invoice(invNo, invdDate, PONo, changeOrderNum, paymentStatus, billAmt, specialNotes, certification);
int paymentStatus = rs.getInt(4);
Double billAmt = rs.getDouble(5);
String specialNotes = rs.getString(6);
String certification = rs.getString(7);
int invoiceStatus = rs.getInt(8);
Invoice invoice = new Invoice(invNo, invdDate, PONo, paymentStatus, billAmt, specialNotes, certification, invoiceStatus);
invoices.add(invoice);
}
return invoices;
@ -351,7 +352,7 @@ public class SqlDAO extends DAO {
}
}
public void updateInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, String changeOrderNum, int pmtStatus, Double billAmt, String specialNotes, String certification)throws AstuteException {
public void updateInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
try {
String sql = "UPDATE INVOICE ";
String updateClause = " SET ";
@ -362,35 +363,14 @@ public class SqlDAO extends DAO {
whereClause = " WHERE UPPER(inv_no) ='" + invoiceNum.toUpperCase() + "'";
}
if (invoiceDate != null ) {
updateClause = updateClause + " inv_date = " + invoiceDate + ",";
}
if (PONum == null || PONum.isEmpty()) {
updateClause = updateClause + " PO_num = '" + PONum + "',";
}
if (changeOrderNum == null || changeOrderNum.isEmpty()) {
updateClause = updateClause + " change_order_num = '" + changeOrderNum + "',";
}
if (pmtStatus > 0 ) {
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
}
if (billAmt > 0) {
updateClause = updateClause + " bill_amt = " + billAmt + ",";
}
if (specialNotes == null || specialNotes.isEmpty()) {
updateClause = updateClause + " special_notes = '" + specialNotes + "',";
}
if (certification == null || certification.isEmpty()) {
updateClause = updateClause + " certification = '" + certification + "',";
}
if (!updateClause.equalsIgnoreCase(" SET ")) {
sql = sql + trimLastCharacter(updateClause,",") + whereClause;
} else {
System.out.println(updateClause);
throw new AstuteException(0, "No values to update.");
}
updateClause = updateClause + " inv_date = " + invoiceDate + ",";
updateClause = updateClause + " PO_num = '" + PONum + "',";
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
updateClause = updateClause + " bill_amt = " + billAmt + ",";
updateClause = updateClause + " special_notes = '" + specialNotes + "',";
updateClause = updateClause + " certification = '" + certification + "',";
updateClause = updateClause + " inv_status = " + invoiceStatus;
sql = sql + updateClause + whereClause;
System.out.println(sql);
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
@ -439,19 +419,19 @@ public class SqlDAO extends DAO {
throw new AstuteException(DB_ERROR,e.getMessage());
}
}
public void createInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, String changeOrderNum, int pmtStatus, Double billAmt, String specialNotes, String certification)throws AstuteException {
public void createInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
try {
System.out.println("Calling create_invoice Procedure");
System.out.println("invoiceNum is "+invoiceNum);
CallableStatement stmt = conn.prepareCall("{call create_invoice(?,?,?,?,?,?,?,?,?)}");
CallableStatement stmt = conn.prepareCall("{call create_invoice(?,?,?,?,?,?,?,?,?,?)}");
stmt.setString(1, invoiceNum);
stmt.setDate(2, invoiceDate);
stmt.setString(3, PONum);
stmt.setString(4, changeOrderNum);
stmt.setInt(5, pmtStatus);
stmt.setDouble(6, billAmt);
stmt.setString(7, specialNotes);
stmt.setString(8, certification);
stmt.setInt(4, pmtStatus);
stmt.setDouble(5, billAmt);
stmt.setString(6, specialNotes);
stmt.setString(7, certification);
stmt.setInt(8, invoiceStatus);
stmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();