mirror of
https://github.com/dyiop/astute.git
synced 2025-04-13 00:30:18 -04:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4752a2063e
AstuteSystem/src/main/java/com/astute
|
@ -110,11 +110,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, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException;
|
public abstract void updateInvoiceMaster(String invoiceNum, String 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, int feeTypeId) throws AstuteException;
|
public abstract void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId) 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 createInvoiceMaster(String invoiceNum, String invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException, ParseException;
|
||||||
|
|
||||||
public abstract void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId) throws AstuteException;
|
public abstract void createInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId) throws AstuteException;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class SqlDAO extends DAO {
|
||||||
} else if (contractNum != null && !contractNum.isEmpty()) {
|
} else if (contractNum != null && !contractNum.isEmpty()) {
|
||||||
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 + "', '%m-%d-%Y')";
|
sql += "WHERE PO_date = STR_TO_DATE('" + PODate + "', '%Y-%m-%d')";
|
||||||
} else if (astuteProjectNumber!= null && !astuteProjectNumber.isEmpty() ) {
|
} else if (astuteProjectNumber!= null && !astuteProjectNumber.isEmpty() ) {
|
||||||
sql += "WHERE UPPER(astute_project_num) = '" + astuteProjectNumber.toUpperCase()+ "'";
|
sql += "WHERE UPPER(astute_project_num) = '" + astuteProjectNumber.toUpperCase()+ "'";
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateClause = updateClause + " contract_num = '" + contractNum + "',";
|
updateClause = updateClause + " contract_num = '" + contractNum + "',";
|
||||||
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%m/%d/%y')" + ",";
|
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%Y-%m-%d')" + ",";
|
||||||
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
|
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
|
||||||
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"',";
|
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"',";
|
||||||
updateClause = updateClause + " title = '" + title +"'";
|
updateClause = updateClause + " title = '" + title +"'";
|
||||||
|
@ -199,8 +199,12 @@ public class SqlDAO extends DAO {
|
||||||
|
|
||||||
public void createPOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException, ParseException {
|
public void createPOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException, ParseException {
|
||||||
try {
|
try {
|
||||||
java.util.Date date= new SimpleDateFormat("yyyy-mm-dd").parse(PODate);
|
java.util.Date date = null;
|
||||||
java.sql.Date poDate = new java.sql.Date(date.getTime());
|
java.sql.Date poDate = null;
|
||||||
|
if (PODate!= null && !PODate.isEmpty()) {
|
||||||
|
date = new SimpleDateFormat("yyyy-MM-dd").parse(PODate);
|
||||||
|
poDate = new java.sql.Date(date.getTime());
|
||||||
|
}
|
||||||
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);
|
||||||
|
@ -315,7 +319,7 @@ public class SqlDAO extends DAO {
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
ResultSet rs = stmt.executeQuery(sql);
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
String invNo = rs.getString(1);
|
String invNo = rs.getString(1);
|
||||||
Date invdDate = rs.getDate(2);
|
String invdDate = rs.getString(2);
|
||||||
String PONo = rs.getString(3);
|
String PONo = rs.getString(3);
|
||||||
int paymentStatus = rs.getInt(4);
|
int paymentStatus = rs.getInt(4);
|
||||||
Double billAmt = rs.getDouble(5);
|
Double billAmt = rs.getDouble(5);
|
||||||
|
@ -373,7 +377,7 @@ public class SqlDAO extends DAO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
|
public void updateInvoiceMaster(String invoiceNum, String 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 ";
|
||||||
|
@ -383,8 +387,7 @@ public class SqlDAO extends DAO {
|
||||||
} else {
|
} else {
|
||||||
whereClause = " WHERE UPPER(inv_no) ='" + invoiceNum.toUpperCase() + "'";
|
whereClause = " WHERE UPPER(inv_no) ='" + invoiceNum.toUpperCase() + "'";
|
||||||
}
|
}
|
||||||
|
updateClause = updateClause + " inv_date = STR_TO_DATE('" + invoiceDate + "', '%Y-%m-%d')" + ",";
|
||||||
updateClause = updateClause + " inv_date = " + invoiceDate + ",";
|
|
||||||
updateClause = updateClause + " PO_num = '" + PONum + "',";
|
updateClause = updateClause + " PO_num = '" + PONum + "',";
|
||||||
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
|
updateClause = updateClause + " pmt_status = " + pmtStatus + ",";
|
||||||
updateClause = updateClause + " bill_amt = " + billAmt + ",";
|
updateClause = updateClause + " bill_amt = " + billAmt + ",";
|
||||||
|
@ -454,13 +457,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, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)throws AstuteException {
|
public void createInvoiceMaster(String invoiceNum, String invoiceDate, String PONum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) throws AstuteException, ParseException {
|
||||||
try {
|
try {
|
||||||
|
java.util.Date date = null;
|
||||||
|
java.sql.Date invDate = null;
|
||||||
|
if (invoiceDate != null) {
|
||||||
|
date= new SimpleDateFormat("yyyy-MM-dd").parse(invoiceDate);
|
||||||
|
invDate = new java.sql.Date(date.getTime());
|
||||||
|
}
|
||||||
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, invDate);
|
||||||
stmt.setString(3, PONum);
|
stmt.setString(3, PONum);
|
||||||
stmt.setInt(4, pmtStatus);
|
stmt.setInt(4, pmtStatus);
|
||||||
stmt.setDouble(5, billAmt);
|
stmt.setDouble(5, billAmt);
|
||||||
|
@ -501,7 +510,7 @@ public class SqlDAO extends DAO {
|
||||||
if (InvoiceNumber == null || InvoiceNumber.isEmpty()) {
|
if (InvoiceNumber == null || InvoiceNumber.isEmpty()) {
|
||||||
throw new AstuteException(0, "Invoice Number should not be null!");
|
throw new AstuteException(0, "Invoice Number should not be null!");
|
||||||
} else {
|
} else {
|
||||||
String sql = "UPDATE INVOICE SET INV_STATUS = 2 WHERE UPPER(INV_NO) = 'UPPER('" + InvoiceNumber + "')";
|
String sql = "UPDATE INVOICE SET INV_STATUS = 2 WHERE UPPER(INV_NO) = UPPER('" + InvoiceNumber + "')";
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
stmt.executeUpdate(sql);
|
stmt.executeUpdate(sql);
|
||||||
}
|
}
|
||||||
|
@ -516,7 +525,7 @@ public class SqlDAO extends DAO {
|
||||||
if (InvoiceNumber == null || InvoiceNumber.isEmpty()) {
|
if (InvoiceNumber == null || InvoiceNumber.isEmpty()) {
|
||||||
throw new AstuteException(0, "Invoice Number should not be null!");
|
throw new AstuteException(0, "Invoice Number should not be null!");
|
||||||
} else {
|
} else {
|
||||||
String sql = "UPDATE INVOICE SET INV_STATUS = 3 WHERE UPPER(INV_NO) = 'UPPER('" + InvoiceNumber + "')";
|
String sql = "UPDATE INVOICE SET INV_STATUS = 3 WHERE UPPER(INV_NO) = UPPER('" + InvoiceNumber + "')";
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
stmt.executeUpdate(sql);
|
stmt.executeUpdate(sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Date;
|
||||||
|
|
||||||
public class Invoice {
|
public class Invoice {
|
||||||
String invoiceNumber;
|
String invoiceNumber;
|
||||||
Date invoiceDate;
|
String invoiceDate;
|
||||||
String poNum;
|
String poNum;
|
||||||
String changeOrderNum;
|
String changeOrderNum;
|
||||||
int pmtStatus;
|
int pmtStatus;
|
||||||
|
@ -13,7 +13,7 @@ public class Invoice {
|
||||||
String certification;
|
String certification;
|
||||||
int invoiceStatus;
|
int invoiceStatus;
|
||||||
|
|
||||||
public Invoice(String invoiceNumber, Date invoiceDate, String poNum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) {
|
public Invoice(String invoiceNumber, String invoiceDate, String poNum, int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus) {
|
||||||
this.invoiceNumber = invoiceNumber;
|
this.invoiceNumber = invoiceNumber;
|
||||||
this.invoiceDate = invoiceDate;
|
this.invoiceDate = invoiceDate;
|
||||||
this.poNum = poNum;
|
this.poNum = poNum;
|
||||||
|
@ -33,11 +33,11 @@ public class Invoice {
|
||||||
this.invoiceNumber = invoiceNumber;
|
this.invoiceNumber = invoiceNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getInvoiceDate() {
|
public String getInvoiceDate() {
|
||||||
return invoiceDate;
|
return invoiceDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInvoiceDate(Date invoiceDate) {
|
public void setInvoiceDate(String invoiceDate) {
|
||||||
this.invoiceDate = invoiceDate;
|
this.invoiceDate = invoiceDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,8 @@ public class InvoiceResource {
|
||||||
@PUT
|
@PUT
|
||||||
public Response updateInvoiceMaster(@PathParam("InvoiceNum") String InvoiceNum, InvoiceMasterRequest request)
|
public Response updateInvoiceMaster(@PathParam("InvoiceNum") String InvoiceNum, InvoiceMasterRequest request)
|
||||||
throws AstuteException, ParseException {
|
throws AstuteException, ParseException {
|
||||||
String dateStr = request.getInvoiceDate();
|
|
||||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
||||||
Date date = new java.sql.Date(df.parse(dateStr).getTime());
|
|
||||||
|
|
||||||
service.updateInvoiceMaster(InvoiceNum, date, request.getPoNum(),
|
service.updateInvoiceMaster(InvoiceNum, request.getInvoiceDate(), request.getPoNum(),
|
||||||
request.getPmtStatus(), request.getBillAmt(), request.getSpecialNotes(), request.getCertification(), request.getInvoiceStatus());
|
request.getPmtStatus(), request.getBillAmt(), request.getSpecialNotes(), request.getCertification(), request.getInvoiceStatus());
|
||||||
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
|
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
|
||||||
}
|
}
|
||||||
|
@ -63,11 +60,8 @@ public class InvoiceResource {
|
||||||
@POST
|
@POST
|
||||||
public Response createInvoiceMaster(InvoiceMasterRequest request)
|
public Response createInvoiceMaster(InvoiceMasterRequest request)
|
||||||
throws AstuteException, ParseException {
|
throws AstuteException, ParseException {
|
||||||
String dateStr = request.getInvoiceDate();
|
|
||||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
||||||
Date date = new java.sql.Date(df.parse(dateStr).getTime());
|
|
||||||
|
|
||||||
service.createInvoiceMaster(request.getInvoiceNumber(), date, request.getPoNum(),
|
service.createInvoiceMaster(request.getInvoiceNumber(), request.getInvoiceDate(), request.getPoNum(),
|
||||||
request.getPmtStatus(), request.getBillAmt(), request.getSpecialNotes(), request.getCertification(), request.getInvoiceStatus());
|
request.getPmtStatus(), request.getBillAmt(), request.getSpecialNotes(), request.getCertification(), request.getInvoiceStatus());
|
||||||
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
|
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.astute.model.*;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.astute.dao.DAO.getDao;
|
import static com.astute.dao.DAO.getDao;
|
||||||
|
@ -24,7 +25,7 @@ public class InvoiceService extends Service{
|
||||||
return getDao().getInvoiceDetail(invoiceNumber, lineItemNo);
|
return getDao().getInvoiceDetail(invoiceNumber, lineItemNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum,
|
public void updateInvoiceMaster(String invoiceNum, String invoiceDate, String PONum,
|
||||||
int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)
|
int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)
|
||||||
throws AstuteException {
|
throws AstuteException {
|
||||||
getDao().updateInvoiceMaster(invoiceNum, invoiceDate, PONum, pmtStatus, billAmt, specialNotes, certification, invoiceStatus);
|
getDao().updateInvoiceMaster(invoiceNum, invoiceDate, PONum, pmtStatus, billAmt, specialNotes, certification, invoiceStatus);
|
||||||
|
@ -38,9 +39,9 @@ public class InvoiceService extends Service{
|
||||||
qty, fee, feeTypeId);
|
qty, fee, feeTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createInvoiceMaster(String invoiceNum, Date invoiceDate, String PONum,
|
public void createInvoiceMaster(String invoiceNum, String invoiceDate, String PONum,
|
||||||
int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)
|
int pmtStatus, Double billAmt, String specialNotes, String certification, int invoiceStatus)
|
||||||
throws AstuteException {
|
throws AstuteException, ParseException {
|
||||||
getDao().createInvoiceMaster(invoiceNum, invoiceDate, PONum, pmtStatus, billAmt, specialNotes, certification, invoiceStatus);
|
getDao().createInvoiceMaster(invoiceNum, invoiceDate, PONum, pmtStatus, billAmt, specialNotes, certification, invoiceStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user