mirror of
https://github.com/dyiop/astute.git
synced 2025-04-06 21:30:20 -04:00
Add files via upload
This commit is contained in:
parent
bfc6238a8f
commit
7ff04150a2
|
@ -109,11 +109,11 @@ public abstract class DAO {
|
||||||
|
|
||||||
public abstract List<InvoiceDetail> getInvoiceDetail(String invoiceNum, int lineItemNo) throws AstuteException;
|
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 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;
|
public abstract void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee) throws AstuteException;
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ public class SqlDAO extends DAO {
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
String whereClause = " WHERE ";
|
String whereClause = " WHERE ";
|
||||||
boolean whereClauseIndicator = false;
|
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()) {
|
if (invoiceNumber != null && !invoiceNumber.isEmpty()) {
|
||||||
whereClause = whereClause + " UPPER(inv_no) = '"+ invoiceNumber.toUpperCase() +"'";
|
whereClause = whereClause + " UPPER(inv_no) = '"+ invoiceNumber.toUpperCase() +"'";
|
||||||
whereClauseIndicator = true;
|
whereClauseIndicator = true;
|
||||||
|
@ -297,12 +297,13 @@ public class SqlDAO extends DAO {
|
||||||
String invNo = rs.getString(1);
|
String invNo = rs.getString(1);
|
||||||
Date invdDate = rs.getDate(2);
|
Date invdDate = rs.getDate(2);
|
||||||
String PONo = rs.getString(3);
|
String PONo = rs.getString(3);
|
||||||
String changeOrderNum = rs.getString(4);
|
int paymentStatus = rs.getInt(4);
|
||||||
int paymentStatus = rs.getInt(5);
|
Double billAmt = rs.getDouble(5);
|
||||||
Double billAmt = rs.getDouble(6);
|
String specialNotes = rs.getString(6);
|
||||||
String specialNotes = rs.getString(7);
|
String certification = rs.getString(7);
|
||||||
String certification = rs.getString(8);
|
int invoiceStatus = rs.getInt(8);
|
||||||
Invoice invoice = new Invoice(invNo, invdDate, PONo, changeOrderNum, paymentStatus, billAmt, specialNotes, certification);
|
|
||||||
|
Invoice invoice = new Invoice(invNo, invdDate, PONo, paymentStatus, billAmt, specialNotes, certification, invoiceStatus);
|
||||||
invoices.add(invoice);
|
invoices.add(invoice);
|
||||||
}
|
}
|
||||||
return invoices;
|
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 {
|
try {
|
||||||
String sql = "UPDATE INVOICE ";
|
String sql = "UPDATE INVOICE ";
|
||||||
String updateClause = " SET ";
|
String updateClause = " SET ";
|
||||||
|
@ -362,35 +363,14 @@ public class SqlDAO extends DAO {
|
||||||
whereClause = " WHERE UPPER(inv_no) ='" + invoiceNum.toUpperCase() + "'";
|
whereClause = " WHERE UPPER(inv_no) ='" + invoiceNum.toUpperCase() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invoiceDate != null ) {
|
updateClause = updateClause + " inv_date = " + invoiceDate + ",";
|
||||||
updateClause = updateClause + " inv_date = " + invoiceDate + ",";
|
updateClause = updateClause + " PO_num = '" + PONum + "',";
|
||||||
}
|
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
|
||||||
if (PONum == null || PONum.isEmpty()) {
|
updateClause = updateClause + " bill_amt = " + billAmt + ",";
|
||||||
updateClause = updateClause + " PO_num = '" + PONum + "',";
|
updateClause = updateClause + " special_notes = '" + specialNotes + "',";
|
||||||
}
|
updateClause = updateClause + " certification = '" + certification + "',";
|
||||||
if (changeOrderNum == null || changeOrderNum.isEmpty()) {
|
updateClause = updateClause + " inv_status = " + invoiceStatus;
|
||||||
updateClause = updateClause + " change_order_num = '" + changeOrderNum + "',";
|
sql = sql + updateClause + whereClause;
|
||||||
}
|
|
||||||
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.");
|
|
||||||
}
|
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
stmt.executeUpdate(sql);
|
stmt.executeUpdate(sql);
|
||||||
|
@ -439,19 +419,19 @@ public class SqlDAO extends DAO {
|
||||||
throw new AstuteException(DB_ERROR,e.getMessage());
|
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 {
|
try {
|
||||||
System.out.println("Calling create_invoice Procedure");
|
System.out.println("Calling create_invoice Procedure");
|
||||||
System.out.println("invoiceNum is "+invoiceNum);
|
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.setString(1, invoiceNum);
|
||||||
stmt.setDate(2, invoiceDate);
|
stmt.setDate(2, invoiceDate);
|
||||||
stmt.setString(3, PONum);
|
stmt.setString(3, PONum);
|
||||||
stmt.setString(4, changeOrderNum);
|
stmt.setInt(4, pmtStatus);
|
||||||
stmt.setInt(5, pmtStatus);
|
stmt.setDouble(5, billAmt);
|
||||||
stmt.setDouble(6, billAmt);
|
stmt.setString(6, specialNotes);
|
||||||
stmt.setString(7, specialNotes);
|
stmt.setString(7, certification);
|
||||||
stmt.setString(8, certification);
|
stmt.setInt(8, invoiceStatus);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user