mirror of
https://github.com/dyiop/astute.git
synced 2025-04-05 21:10:16 -04:00
Add files via upload
This commit is contained in:
parent
635a69bfac
commit
456a68e291
|
@ -118,18 +118,10 @@ public class SqlDAO extends DAO {
|
|||
whereClause = " WHERE UPPER(PO_num) ='" + PONum.toUpperCase() + "'";
|
||||
}
|
||||
|
||||
// if (contractNum != null && !contractNum.isEmpty()) {
|
||||
updateClause = updateClause + " contract_num = '" + contractNum + "',";
|
||||
// }
|
||||
// if (PODate != null) {
|
||||
updateClause = updateClause + " PO_Date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')" + ",";
|
||||
// }
|
||||
// if (contractAmt != null && contractAmt > 0) {
|
||||
updateClause = updateClause + " contract_amt = " + contractAmt;
|
||||
// }
|
||||
// if (astuteProjectNumber != null && !astuteProjectNumber.isEmpty()) {
|
||||
updateClause = updateClause + " astuteProjectNumber = '" + astuteProjectNumber + "',";
|
||||
// }
|
||||
updateClause = updateClause + " contract_num = '" + contractNum + "',";
|
||||
updateClause = updateClause + " PO_Date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')" + ",";
|
||||
updateClause = updateClause + " contract_amt = " + contractAmt;
|
||||
updateClause = updateClause + " astuteProjectNumber = '" + astuteProjectNumber + "',";
|
||||
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
||||
sql = sql + trimLastCharacter(updateClause, ",") + whereClause;
|
||||
|
||||
|
@ -157,6 +149,7 @@ public class SqlDAO extends DAO {
|
|||
|
||||
public void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId) throws AstuteException {
|
||||
try {
|
||||
|
||||
String sql = "UPDATE PO_DETAIL ";
|
||||
String updateClause = " SET ";
|
||||
String whereClause = " WHERE UPPER(PO_num) = '" + POnum.toUpperCase() + "' AND line_item_no = " + lineItemNo;
|
||||
|
@ -168,30 +161,27 @@ public class SqlDAO extends DAO {
|
|||
if (lineItemNo < 0) {
|
||||
throw new AstuteException(0, "Line item Number must be greater than 0.");
|
||||
}
|
||||
if (serviceDesc != null && !serviceDesc.isEmpty()) {
|
||||
updateClause += " service_desc = '" + serviceDesc + "',";
|
||||
}
|
||||
if (feeTypeId > 0) {
|
||||
updateClause += " fee_type_id = " + feeTypeId + ",";
|
||||
}
|
||||
if (qty != null && qty > 0) {
|
||||
updateClause += " qty = " + qty + ",";
|
||||
}
|
||||
if (fee != null && fee > 0) {
|
||||
updateClause += " fee = " + fee + ",";
|
||||
}
|
||||
if (serviceTypeId > 0) {
|
||||
updateClause += " service_type_id = " + serviceTypeId + ",";
|
||||
}
|
||||
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
||||
sql = sql + trimLastCharacter(updateClause, ",") + whereClause;
|
||||
|
||||
List<PODetail> lineItem = getPODetail(POnum, lineItemNo);
|
||||
if (lineItem.size() == 0) {
|
||||
// new line item
|
||||
createPODetail(POnum, lineItemNo, serviceDesc, feeTypeId, qty, fee, serviceTypeId);
|
||||
} else {
|
||||
throw new AstuteException(0, "No values to update.");
|
||||
updateClause += " service_desc = '" + serviceDesc + "',";
|
||||
updateClause += " fee_type_id = " + feeTypeId + ",";
|
||||
updateClause += " qty = " + qty + ",";
|
||||
updateClause += " fee = " + fee + ",";
|
||||
updateClause += " service_type_id = " + serviceTypeId + ",";
|
||||
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
||||
sql = sql + trimLastCharacter(updateClause, ",") + whereClause;
|
||||
|
||||
} else {
|
||||
throw new AstuteException(0, "No values to update.");
|
||||
}
|
||||
System.out.println(sql);
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.executeUpdate(sql);
|
||||
}
|
||||
System.out.println(sql);
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
throw new AstuteException(DB_ERROR,e.getMessage());
|
||||
|
|
Loading…
Reference in New Issue
Block a user