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
a73e859fa2
commit
ce93f0f0ae
|
@ -92,17 +92,17 @@ public abstract class DAO {
|
||||||
*/
|
*/
|
||||||
public abstract void connect() throws AstuteException;
|
public abstract void connect() throws AstuteException;
|
||||||
|
|
||||||
public abstract List<PO> getPOMaster(String PONum, String contractNum, java.sql.Date PODate) throws AstuteException;
|
public abstract List<PO> getPOMaster(String PONum, String contractNum, java.sql.Date PODate, String astuteProjectNumber) throws AstuteException;
|
||||||
|
|
||||||
public abstract List<PODetail> getPODetail(String PONum, int lineItemNo) throws AstuteException;
|
public abstract List<PODetail> getPODetail(String PONum, int lineItemNo) throws AstuteException;
|
||||||
|
|
||||||
public abstract void updatePOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt) throws AstuteException;
|
public abstract void updatePOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt, String astuteProjectNumber) throws AstuteException;
|
||||||
|
|
||||||
public abstract void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException;
|
public abstract void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId) throws AstuteException;
|
||||||
|
|
||||||
public abstract void createPOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt, int customerId) throws AstuteException;
|
public abstract void createPOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt, int customerId, String astuteProjectNumber) throws AstuteException;
|
||||||
|
|
||||||
public abstract void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException;
|
public abstract void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId) throws AstuteException;
|
||||||
|
|
||||||
|
|
||||||
public abstract List<Invoice> getInvoiceMaster(String invoiceNumber, int pmtStatus) throws AstuteException;
|
public abstract List<Invoice> getInvoiceMaster(String invoiceNumber, int pmtStatus) throws AstuteException;
|
||||||
|
@ -111,11 +111,11 @@ public abstract class DAO {
|
||||||
|
|
||||||
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, String changeOrderNum, int pmtStatus, Double billAmt, String specialNotes, String certification) throws AstuteException;
|
||||||
|
|
||||||
public abstract void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double percentCompletion, double hours, double amount) 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, String changeOrderNum, int pmtStatus, Double billAmt, String specialNotes, String certification) throws AstuteException;
|
||||||
|
|
||||||
public abstract void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double percentCompletion, double hours, double amount) throws AstuteException;
|
public abstract void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee) throws AstuteException;
|
||||||
|
|
||||||
public abstract String generateInvoiceNumber(String poNum) throws AstuteException;
|
public abstract String generateInvoiceNumber(String poNum) throws AstuteException;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class SqlDAO extends DAO {
|
||||||
=============================== PO Methods ===============================================
|
=============================== PO Methods ===============================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public List<PO> getPOMaster(String PONum, String contractNum, Date PODate) throws AstuteException {
|
public List<PO> getPOMaster(String PONum, String contractNum, Date PODate, String astuteProjectNumber) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
List<PO> pos = new ArrayList<>();
|
List<PO> pos = new ArrayList<>();
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
|
@ -47,6 +47,8 @@ public class SqlDAO extends DAO {
|
||||||
sql += "WHERE UPPER(contract_num) = '" + contractNum.toUpperCase()+ "'";
|
sql += "WHERE UPPER(contract_num) = '" + contractNum.toUpperCase()+ "'";
|
||||||
} else if (PODate != null) {
|
} else if (PODate != null) {
|
||||||
sql += "WHERE PO_date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')";
|
sql += "WHERE PO_date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')";
|
||||||
|
} else if (astuteProjectNumber!= null) {
|
||||||
|
sql += "WHERE UPPER(astuteProjectNumber) = '" + astuteProjectNumber.toUpperCase()+ "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
ResultSet rs = stmt.executeQuery(sql);
|
||||||
|
@ -72,7 +74,7 @@ public class SqlDAO extends DAO {
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
String whereClause = " WHERE ";
|
String whereClause = " WHERE ";
|
||||||
boolean whereClauseCriteria = false;
|
boolean whereClauseCriteria = false;
|
||||||
String sql = "SELECT PO_num, line_item_no, service_desc, fee_type_id, qty, service_type_id, get_remaining_qty_fun(PO_num, line_item_no) as get_remaining_qty FROM PO_DETAIL ";
|
String sql = "SELECT PO_num, line_item_no, service_desc, fee_type_id, qty, fee, service_type_id, get_remaining_qty_fun(PO_num, line_item_no) as get_remaining_qty FROM PO_DETAIL ";
|
||||||
if (PONum != null) {
|
if (PONum != null) {
|
||||||
whereClause = whereClause + " UPPER(PO_num) = '" + PONum.toUpperCase() + "'";
|
whereClause = whereClause + " UPPER(PO_num) = '" + PONum.toUpperCase() + "'";
|
||||||
whereClauseCriteria = true;
|
whereClauseCriteria = true;
|
||||||
|
@ -92,9 +94,10 @@ public class SqlDAO extends DAO {
|
||||||
String serviceDesc = rs.getString(3);
|
String serviceDesc = rs.getString(3);
|
||||||
int feeTypeId = rs.getInt(4);
|
int feeTypeId = rs.getInt(4);
|
||||||
Double qty = rs.getDouble(5);
|
Double qty = rs.getDouble(5);
|
||||||
int serviceTypeId = rs.getInt(6);
|
Double fee = rs.getDouble(6);
|
||||||
double remainingQty = rs.getInt(7);
|
int serviceTypeId = rs.getInt(7);
|
||||||
PODetail poDetail = new PODetail(poNum, lineItemNum, serviceDesc, feeTypeId, qty, serviceTypeId, remainingQty);
|
double remainingQty = rs.getInt(8);
|
||||||
|
PODetail poDetail = new PODetail(poNum, lineItemNum, serviceDesc, feeTypeId, qty, fee, serviceTypeId, remainingQty);
|
||||||
poDetails.add(poDetail);
|
poDetails.add(poDetail);
|
||||||
}
|
}
|
||||||
return poDetails;
|
return poDetails;
|
||||||
|
@ -104,7 +107,7 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt) throws AstuteException {
|
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
String sql = "UPDATE PO ";
|
String sql = "UPDATE PO ";
|
||||||
String updateClause = " SET ";
|
String updateClause = " SET ";
|
||||||
|
@ -115,15 +118,18 @@ public class SqlDAO extends DAO {
|
||||||
whereClause = " WHERE UPPER(PO_num) ='" + PONum.toUpperCase() + "'";
|
whereClause = " WHERE UPPER(PO_num) ='" + PONum.toUpperCase() + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contractNum != null && !contractNum.isEmpty()) {
|
// if (contractNum != null && !contractNum.isEmpty()) {
|
||||||
updateClause = updateClause + " contract_num = '" + contractNum.toUpperCase() + "',";
|
updateClause = updateClause + " contract_num = '" + contractNum.toUpperCase() + "',";
|
||||||
}
|
// }
|
||||||
if (PODate != null) {
|
// if (PODate != null) {
|
||||||
updateClause = updateClause + " PO_Date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')" + ",";
|
updateClause = updateClause + " PO_Date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')" + ",";
|
||||||
}
|
// }
|
||||||
if (contractAmt != null && contractAmt > 0) {
|
// if (contractAmt != null && contractAmt > 0) {
|
||||||
updateClause = updateClause + " contract_amt = " + contractAmt;
|
updateClause = updateClause + " contract_amt = " + contractAmt;
|
||||||
}
|
// }
|
||||||
|
// if (astuteProjectNumber != null && !astuteProjectNumber.isEmpty()) {
|
||||||
|
updateClause = updateClause + " astuteProjectNumber = '" + astuteProjectNumber + "',";
|
||||||
|
// }
|
||||||
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
||||||
sql = sql + trimLastCharacter(updateClause, ",") + whereClause;
|
sql = sql + trimLastCharacter(updateClause, ",") + whereClause;
|
||||||
|
|
||||||
|
@ -149,7 +155,7 @@ public class SqlDAO extends DAO {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException {
|
public void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
String sql = "UPDATE PO_DETAIL ";
|
String sql = "UPDATE PO_DETAIL ";
|
||||||
String updateClause = " SET ";
|
String updateClause = " SET ";
|
||||||
|
@ -171,6 +177,9 @@ public class SqlDAO extends DAO {
|
||||||
if (qty != null && qty > 0) {
|
if (qty != null && qty > 0) {
|
||||||
updateClause += " qty = " + qty + ",";
|
updateClause += " qty = " + qty + ",";
|
||||||
}
|
}
|
||||||
|
if (fee != null && fee > 0) {
|
||||||
|
updateClause += " fee = " + fee + ",";
|
||||||
|
}
|
||||||
if (serviceTypeId > 0) {
|
if (serviceTypeId > 0) {
|
||||||
updateClause += " service_type_id = " + serviceTypeId + ",";
|
updateClause += " service_type_id = " + serviceTypeId + ",";
|
||||||
}
|
}
|
||||||
|
@ -189,14 +198,15 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, int customerId) throws AstuteException {
|
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, int customerId, String astuteProjectNumber) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
CallableStatement stmt = conn.prepareCall("{call create_PO(?,?,?,?,?)}");
|
CallableStatement stmt = conn.prepareCall("{call create_PO(?,?,?,?,?,?)}");
|
||||||
stmt.setString(1, PONum);
|
stmt.setString(1, PONum);
|
||||||
stmt.setString(2, contractNum);
|
stmt.setString(2, contractNum);
|
||||||
stmt.setDate(3, PODate);
|
stmt.setDate(3, PODate);
|
||||||
stmt.setDouble(4, contractAmt);
|
stmt.setDouble(4, contractAmt);
|
||||||
stmt.setInt(5, customerId);
|
stmt.setInt(5, customerId);
|
||||||
|
stmt.setString(6, astuteProjectNumber);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -204,17 +214,18 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, int serviceTypeId) throws AstuteException {
|
public void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId) throws AstuteException {
|
||||||
try {
|
try {
|
||||||
System.out.println("Calling create_po_detail Procedure");
|
System.out.println("Calling create_po_detail Procedure");
|
||||||
System.out.println("POnum is " + POnum);
|
System.out.println("POnum is " + POnum);
|
||||||
CallableStatement stmt = conn.prepareCall("{call create_po_detail(?,?,?,?,?,?)}");
|
CallableStatement stmt = conn.prepareCall("{call create_po_detail(?,?,?,?,?,?,?)}");
|
||||||
stmt.setString(1, POnum);
|
stmt.setString(1, POnum);
|
||||||
stmt.setInt(2, lineItemNo);
|
stmt.setInt(2, lineItemNo);
|
||||||
stmt.setString(3, serviceDesc);
|
stmt.setString(3, serviceDesc);
|
||||||
stmt.setInt(4, feeTypeId);
|
stmt.setInt(4, feeTypeId);
|
||||||
stmt.setDouble(5, qty);
|
stmt.setDouble(5, qty);
|
||||||
stmt.setInt(6, serviceTypeId);
|
stmt.setDouble(6, fee);
|
||||||
|
stmt.setInt(7, serviceTypeId);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -264,7 +275,7 @@ public class SqlDAO extends DAO {
|
||||||
Invoice invoice = getInvoiceMaster(invoiceNumber, 0).get(0);
|
Invoice invoice = getInvoiceMaster(invoiceNumber, 0).get(0);
|
||||||
String PONo = invoice.getPoNum();
|
String PONo = invoice.getPoNum();
|
||||||
List<InvoiceDetail> invoiceDetail = getInvoiceDetail(invoiceNumber, 0);
|
List<InvoiceDetail> invoiceDetail = getInvoiceDetail(invoiceNumber, 0);
|
||||||
PO po = getPOMaster(PONo, null, null).get(0);
|
PO po = getPOMaster(PONo, null, null, null).get(0);
|
||||||
Integer customerId = po.getCustomerId();
|
Integer customerId = po.getCustomerId();
|
||||||
Customer customer = getCustomers(customerId).get(0);
|
Customer customer = getCustomers(customerId).get(0);
|
||||||
Double previouslyBilledAmt = getPreviouslyBilledAmount(PONo);
|
Double previouslyBilledAmt = getPreviouslyBilledAmount(PONo);
|
||||||
|
@ -343,10 +354,9 @@ public class SqlDAO extends DAO {
|
||||||
int POLineItemNum = rs.getInt(3);
|
int POLineItemNum = rs.getInt(3);
|
||||||
int serviceTypeId = rs.getInt(4);
|
int serviceTypeId = rs.getInt(4);
|
||||||
String desc = rs.getString(5);
|
String desc = rs.getString(5);
|
||||||
Double percentCompletion = rs.getDouble(6);
|
Double qty = rs.getDouble(6);
|
||||||
Double hours = rs.getDouble(7);
|
Double fee = rs.getDouble(7);
|
||||||
Double amount = rs.getDouble(8);
|
InvoiceDetail service = new InvoiceDetail(invNo, lineItemNum, POLineItemNum, serviceTypeId, desc, qty, fee);
|
||||||
InvoiceDetail service = new InvoiceDetail(invNo, lineItemNum, POLineItemNum, serviceTypeId, desc, percentCompletion, hours, amount);
|
|
||||||
services.add(service);
|
services.add(service);
|
||||||
}
|
}
|
||||||
return services;
|
return services;
|
||||||
|
@ -405,7 +415,7 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double percentCompletion, double hours, double amount)throws AstuteException {
|
public void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee)throws AstuteException {
|
||||||
try {
|
try {
|
||||||
String sql = "UPDATE INVOICE_DETAIL ";
|
String sql = "UPDATE INVOICE_DETAIL ";
|
||||||
String updateClause = " SET ";
|
String updateClause = " SET ";
|
||||||
|
@ -424,16 +434,12 @@ public class SqlDAO extends DAO {
|
||||||
if(desc != null && !desc.isEmpty()) {
|
if(desc != null && !desc.isEmpty()) {
|
||||||
updateClause += " description = '" + desc + "',";
|
updateClause += " description = '" + desc + "',";
|
||||||
}
|
}
|
||||||
if(percentCompletion >0) {
|
if(qty >0) {
|
||||||
updateClause += " percent_completion = " + percentCompletion + ",";
|
updateClause += " qty = " + qty + ",";
|
||||||
}
|
}
|
||||||
if(hours > 0) {
|
if(fee > 0) {
|
||||||
updateClause += " hours = " + hours + ",";
|
updateClause += " fee = " + fee + ",";
|
||||||
}
|
}
|
||||||
if(amount >0) {
|
|
||||||
updateClause += " amt = " + amount + ",";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
if (!updateClause.equalsIgnoreCase(" SET ")) {
|
||||||
sql = sql + trimLastCharacter(updateClause,",") + whereClause;
|
sql = sql + trimLastCharacter(updateClause,",") + whereClause;
|
||||||
|
|
||||||
|
@ -469,7 +475,7 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double percentCompletion, double hours, double amount)throws AstuteException {
|
public void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee)throws AstuteException {
|
||||||
try {
|
try {
|
||||||
System.out.println("Calling create_invoice_detail Procedure");
|
System.out.println("Calling create_invoice_detail Procedure");
|
||||||
System.out.println("invoiceNum is "+invoiceNum);
|
System.out.println("invoiceNum is "+invoiceNum);
|
||||||
|
@ -479,9 +485,8 @@ public class SqlDAO extends DAO {
|
||||||
stmt.setInt(3, POLineItemNum);
|
stmt.setInt(3, POLineItemNum);
|
||||||
stmt.setInt(4, serviceTypeId);
|
stmt.setInt(4, serviceTypeId);
|
||||||
stmt.setString(5, desc);
|
stmt.setString(5, desc);
|
||||||
stmt.setDouble(6, percentCompletion);
|
stmt.setDouble(6, qty);
|
||||||
stmt.setDouble(7, hours);
|
stmt.setDouble(7, fee);
|
||||||
stmt.setDouble(8, amount);
|
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user