Add files via upload

This commit is contained in:
gopi17701 2018-08-23 15:31:09 -04:00 committed by GitHub
parent d9565444e1
commit e4d128b80d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -404,29 +404,24 @@ public class SqlDAO extends DAO {
}
}
public void updateRemainingQty(String poNum, int lineItemNo) throws AstuteException {
public Double updateRemainingQty(String poNum, String inv_no, int lineItemNo) throws AstuteException {
try {
String sql = " UPDATE PO SET remaining_qty = get_remaining_qty_fun('" + poNum + "'," + lineItemNo + ")";
System.out.println(sql);
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
throw new AstuteException(DB_ERROR, e.getMessage());
Double remainingQty;
System.out.println("Calling update_remaining_qty_fun DB function");
System.out.println("poNum is " + poNum);
CallableStatement stmt = conn.prepareCall("{? = call update_remaining_qty_fun(?,?,?)}");
stmt.registerOutParameter(1, Types.DOUBLE);
stmt.setString(2, poNum);
stmt.setString(3, inv_no);
stmt.setInt(4, lineItemNo);
stmt.execute();
remainingQty = stmt.getDouble(1);
return remainingQty;
} catch (SQLException e) {
e.printStackTrace();
throw new AstuteException(DB_ERROR,e.getMessage());
}
}
}
public void updateInvRemainingQty(String invNum, int poLineItemNo) throws AstuteException {
try {
String sql = " UPDATE PO SET remaining_qty = get_inv_remaining_qty_fun('" + invNum + "'," + poLineItemNo + ")";
System.out.println(sql);
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
throw new AstuteException(DB_ERROR, e.getMessage());
}
}
public void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId)throws AstuteException {
try {
String sql = "UPDATE INVOICE_DETAIL ";
@ -451,7 +446,7 @@ public class SqlDAO extends DAO {
System.out.println(sql);
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
updateInvRemainingQty(invoiceNum, POLineItemNum);
updateRemainingQty(null,invoiceNum, POLineItemNum);
} catch (SQLException e) {
e.printStackTrace();
throw new AstuteException(DB_ERROR,e.getMessage());
@ -488,7 +483,7 @@ public class SqlDAO extends DAO {
try {
System.out.println("Calling create_invoice_detail Procedure");
System.out.println("invoiceNum is "+invoiceNum);
CallableStatement stmt = conn.prepareCall("{call create_invoice_detail(?,?,?,?,?,?,?,?,?)}");
CallableStatement stmt = conn.prepareCall("{call create_invoice_detail(?,?,?,?,?,?,?,?)}");
stmt.setString(1, invoiceNum);
stmt.setInt(2, lineItemNum);
stmt.setInt(3, POLineItemNum);
@ -498,7 +493,7 @@ public class SqlDAO extends DAO {
stmt.setDouble(7, fee);
stmt.setInt(8, feeTypeId);
stmt.executeUpdate();
updateInvRemainingQty(invoiceNum, POLineItemNum);
updateRemainingQty(null,invoiceNum, POLineItemNum);
} catch (SQLException e) {
e.printStackTrace();
throw new AstuteException(DB_ERROR,e.getMessage());