mirror of
https://github.com/dyiop/astute.git
synced 2025-04-06 21:30:20 -04:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f6c805b01b
|
@ -125,7 +125,7 @@
|
|||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Fax*</span>
|
||||
<span class="input-group-text">Fax</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" #inFax>
|
||||
|
@ -237,7 +237,7 @@
|
|||
|
||||
<tr>
|
||||
<td style="width: 1%">
|
||||
<span class="input-group-text">Fax*</span>
|
||||
<span class="input-group-text">Fax</span>
|
||||
</td>
|
||||
<td colspan="7">
|
||||
<input type="tel" class="form-control" #inFax [value]="selected.fax">
|
||||
|
@ -249,7 +249,7 @@
|
|||
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning" type="button"
|
||||
[disabled]="!(inName.value && inBillToDept.value && inAdd1.value && inCity.value && inState.value && inZIP.value && inEmail.value && inPhone.value && inFax.value)"
|
||||
[disabled]="!(inName.value && inBillToDept.value && inAdd1.value && inCity.value && inState.value && inZIP.value && inEmail.value && inPhone.value)"
|
||||
(click)="editCustomer(selected.customerId ,inName.value, inBillToDept.value, inAdd1.value, inAdd2.value, inCity.value, inState.value, inZIP.value, inZIP4.value, inEmail.value, inPhone.value, inFax.value, edit)">
|
||||
Update
|
||||
</button>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Astute Project Number</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="number" class="form-control" placeholder="Project Number" #projNum>
|
||||
<input type="text" class="form-control" placeholder="Project Number" #projNum>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -46,7 +46,7 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">SO Title</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" placeholder="SO Title" #potitle>
|
||||
<input type="text" class="form-control" placeholder="SO Title" #title>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -58,7 +58,7 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">SO Date</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="date" class="form-control" [value]="getCurrDate()" #podate>
|
||||
<input type="text" class="form-control" [value]="getCurrDate()" #podate>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -170,7 +170,7 @@
|
|||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="!(ponum.value && podate.value && customerid.value && contractnum.value && contractamt.value)"
|
||||
(click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value, potitle.value, new)"
|
||||
(click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value, title.value, new)"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
|
@ -203,10 +203,7 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">SO Title</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" [value]="selected.title" #customerid disabled>
|
||||
<option *ngFor="let customer of customers" [value]="customer.title">{{customer.title}}
|
||||
</option>
|
||||
</select>
|
||||
<input type="text" class="form-control" [value]="selected.title" #title>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -218,7 +215,7 @@
|
|||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">SO Date</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="date" class="form-control" [value]="selected.podate" #podate>
|
||||
<input type="text" class="form-control" [value]="selected.podate" #podate>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -332,7 +329,7 @@
|
|||
<div class="modal-footer">
|
||||
<button class="btn btn-success" type="button"
|
||||
[disabled]="!(ponum.value && podate.value && contractnum.value && contractamt.value)"
|
||||
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, potitle.value, edit)"
|
||||
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, title.value, edit)"
|
||||
>
|
||||
Update
|
||||
</button>
|
||||
|
|
|
@ -36,11 +36,11 @@ export class SalesOrderComponent implements OnInit {
|
|||
const poData = {
|
||||
"astuteProjectNumber": projNum,
|
||||
"poNum": ponum,
|
||||
"PODate": this.formatDate(new Date(podate)),
|
||||
"PODate": podate,
|
||||
"customerId": customerid,
|
||||
"contractNum": contractnum,
|
||||
"contractAmt": contractamt,
|
||||
"title": title,
|
||||
"contractAmt": contractamt,
|
||||
"title": title,
|
||||
}
|
||||
console.log (poData.PODate);
|
||||
this.astuteClientService.createPO(poData).then((data) => {
|
||||
|
@ -76,7 +76,7 @@ export class SalesOrderComponent implements OnInit {
|
|||
const poData = {
|
||||
"astuteProjectNumber": projNum,
|
||||
"poNum": ponum,
|
||||
"PODate": this.formatDate(new Date(podate)),
|
||||
"PODate": podate,
|
||||
"contractNum": contractnum,
|
||||
"contractAmt": contractamt,
|
||||
"title": title,
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.io.InputStream;
|
|||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -92,15 +93,15 @@ public abstract class DAO {
|
|||
*/
|
||||
public abstract void connect() throws AstuteException;
|
||||
|
||||
public abstract List<PO> getPOMaster(String PONum, String contractNum, java.sql.Date PODate, String astuteProjectNumber) throws AstuteException;
|
||||
public abstract List<PO> getPOMaster(String PONum, String contractNum, String PODate, String astuteProjectNumber) 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, String astuteProjectNumber, String title) throws AstuteException;
|
||||
public abstract void updatePOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String astuteProjectNumber, String title) throws AstuteException;
|
||||
|
||||
public abstract void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId, Double remainingQuantity) throws AstuteException;
|
||||
|
||||
public abstract void createPOMaster(String PONum, String contractNum, java.sql.Date PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException;
|
||||
public abstract void createPOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException, ParseException;
|
||||
|
||||
public abstract void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId, Double remainingQuantity) throws AstuteException;
|
||||
|
||||
|
|
|
@ -10,9 +10,11 @@ import java.security.NoSuchAlgorithmException;
|
|||
import java.security.SecureRandom;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.sql.*;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import static com.astute.exceptions.AstuteException.DB_ERROR;
|
||||
|
||||
|
@ -36,17 +38,17 @@ public class SqlDAO extends DAO {
|
|||
=============================== PO Methods ===============================================
|
||||
*/
|
||||
|
||||
public List<PO> getPOMaster(String PONum, String contractNum, Date PODate, String astuteProjectNumber) throws AstuteException {
|
||||
public List<PO> getPOMaster(String PONum, String contractNum, String PODate, String astuteProjectNumber) throws AstuteException {
|
||||
try {
|
||||
List<PO> pos = new ArrayList<>();
|
||||
Statement stmt = conn.createStatement();
|
||||
String sql = "SELECT PO_num, contract_num, PO_date, customer_id, contract_amt, astute_project_num , title FROM PO ";
|
||||
String sql = "SELECT PO_num, contract_num, PO_date, customer_id, contract_amt, astute_project_num , title, get_previously_billed_amt(PO_num) FROM PO ";
|
||||
if (PONum != null && !PONum.isEmpty()) {
|
||||
sql += "WHERE UPPER(PO_num) = '" + PONum.toUpperCase() + "'";
|
||||
} else if (contractNum != null && !contractNum.isEmpty()) {
|
||||
sql += "WHERE UPPER(contract_num) = '" + contractNum.toUpperCase()+ "'";
|
||||
} else if (PODate != null) {
|
||||
sql += "WHERE PO_date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')";
|
||||
sql += "WHERE PO_date = STR_TO_DATE('" + PODate + "', '%m-%d-%Y')";
|
||||
} else if (astuteProjectNumber!= null && !astuteProjectNumber.isEmpty() ) {
|
||||
sql += "WHERE UPPER(astute_project_num) = '" + astuteProjectNumber.toUpperCase()+ "'";
|
||||
}
|
||||
|
@ -60,7 +62,13 @@ public class SqlDAO extends DAO {
|
|||
Double contractAmt = rs.getDouble(5);
|
||||
String astuteProjectNum = rs.getString(6);
|
||||
String title = rs.getString(7);
|
||||
PO po = new PO(poNum, cntrctNum, poDate, customerId, contractAmt,astuteProjectNum,title);
|
||||
Double previouslyBilledAmount = rs.getDouble(8);
|
||||
String date = null;
|
||||
if (poDate != null) {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("MM/DD/YYYY");
|
||||
date = formatter.format(poDate);
|
||||
}
|
||||
PO po = new PO(poNum, cntrctNum, date, customerId, contractAmt,astuteProjectNum,title,previouslyBilledAmount);
|
||||
pos.add(po);
|
||||
}
|
||||
return pos;
|
||||
|
@ -109,8 +117,10 @@ public class SqlDAO extends DAO {
|
|||
}
|
||||
}
|
||||
|
||||
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber, String title) throws AstuteException {
|
||||
public void updatePOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String astuteProjectNumber, String title) throws AstuteException {
|
||||
try {
|
||||
System.out.println("PODate in SQLDAO is "+ PODate);
|
||||
|
||||
String sql = "UPDATE PO ";
|
||||
String updateClause = " SET ";
|
||||
String whereClause = "";
|
||||
|
@ -121,9 +131,9 @@ public class SqlDAO extends DAO {
|
|||
}
|
||||
|
||||
updateClause = updateClause + " contract_num = '" + contractNum + "',";
|
||||
updateClause = updateClause + " PO_Date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')" + ",";
|
||||
updateClause = updateClause + " PO_Date = STR_TO_DATE('" + PODate + "', '%m/%d/%y')" + ",";
|
||||
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
|
||||
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"'";
|
||||
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"',";
|
||||
updateClause = updateClause + " title = '" + title +"'";
|
||||
sql = sql+ updateClause + whereClause;
|
||||
System.out.println(sql);
|
||||
|
@ -187,12 +197,14 @@ public class SqlDAO extends DAO {
|
|||
}
|
||||
}
|
||||
|
||||
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException {
|
||||
public void createPOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException, ParseException {
|
||||
try {
|
||||
Date date= (Date) new SimpleDateFormat("yyyy/mm/dd").parse(PODate);
|
||||
|
||||
CallableStatement stmt = conn.prepareCall("{call create_PO(?,?,?,?,?,?,?)}");
|
||||
stmt.setString(1, PONum);
|
||||
stmt.setString(2, contractNum);
|
||||
stmt.setDate(3, PODate);
|
||||
stmt.setDate(3, date);
|
||||
stmt.setDouble(4, contractAmt);
|
||||
stmt.setString(5, customerId);
|
||||
stmt.setString(6, astuteProjectNumber);
|
||||
|
|
|
@ -7,13 +7,14 @@ import java.util.Date;
|
|||
public class PO implements Serializable{
|
||||
|
||||
private String contractNum;
|
||||
private Date PODate;
|
||||
private String PODate;
|
||||
private Double contractAmt;
|
||||
private String customerId;
|
||||
private String astuteProjectNumber;
|
||||
private String title;
|
||||
private Double previouslyBilledAmount;
|
||||
|
||||
public PO(String PONum, String contractNum, Date PODate, String customerId, Double contractAmt, String astuteProjectNum, String title) {
|
||||
public PO(String PONum, String contractNum, String PODate, String customerId, Double contractAmt, String astuteProjectNum, String title, Double previouslyBilledAmount) {
|
||||
this.PONum = PONum;
|
||||
this.contractNum = contractNum;
|
||||
this.PODate = PODate;
|
||||
|
@ -21,7 +22,7 @@ public class PO implements Serializable{
|
|||
this.contractAmt = contractAmt;
|
||||
this.astuteProjectNumber = astuteProjectNum;
|
||||
this.title = title;
|
||||
|
||||
this.previouslyBilledAmount = previouslyBilledAmount;
|
||||
}
|
||||
|
||||
private String PONum;
|
||||
|
@ -42,11 +43,11 @@ public class PO implements Serializable{
|
|||
this.contractNum = contractNum;
|
||||
}
|
||||
|
||||
public Date getPODate() {
|
||||
public String getPODate() {
|
||||
return PODate;
|
||||
}
|
||||
|
||||
public void setPODate(Date PODate) {
|
||||
public void setPODate(String PODate) {
|
||||
this.PODate = PODate;
|
||||
}
|
||||
|
||||
|
@ -81,4 +82,12 @@ public class PO implements Serializable{
|
|||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Double getPreviouslyBilledAmount() {
|
||||
return previouslyBilledAmount;
|
||||
}
|
||||
|
||||
public void setPreviouslyBilledAmount(Double previouslyBilledAmount) {
|
||||
this.previouslyBilledAmount = previouslyBilledAmount;
|
||||
}
|
||||
}
|
|
@ -29,12 +29,7 @@ public class POResource {
|
|||
@QueryParam("ContractNum") String contractNum,
|
||||
@QueryParam("PODate") String PODate, String astuteProjectNumber)
|
||||
throws AstuteException, ParseException {
|
||||
Date date = null;
|
||||
if (PODate != null) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
date = new java.sql.Date(df.parse(PODate).getTime());
|
||||
}
|
||||
return new ApiResponse(POService.getPOMaster(PONum, contractNum, date, astuteProjectNumber)).toResponse();
|
||||
return new ApiResponse(POService.getPOMaster(PONum, contractNum, PODate, astuteProjectNumber)).toResponse();
|
||||
}
|
||||
|
||||
@Path("/detail")
|
||||
|
@ -48,13 +43,9 @@ public class POResource {
|
|||
@PUT
|
||||
public Response updatePOMaster(@PathParam("PONum") String PONum, POMasterRequest request)
|
||||
throws AstuteException, ParseException {
|
||||
Date date = null;
|
||||
if (request.getPODate() != null) {
|
||||
String dateStr = request.getPODate();
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
date = new java.sql.Date(df.parse(dateStr).getTime());
|
||||
}
|
||||
POService.updatePOMaster(PONum, request.getContractNum(), date, request.getContractAmt(), request.getAstuteProjectNumber(), request.getTitle());
|
||||
System.out.println("PODate in Resource is "+ request.getPODate());
|
||||
|
||||
POService.updatePOMaster(PONum, request.getContractNum(), request.getPODate(), request.getContractAmt(), request.getAstuteProjectNumber(), request.getTitle());
|
||||
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
|
||||
}
|
||||
|
||||
|
@ -70,14 +61,8 @@ public class POResource {
|
|||
@POST
|
||||
public Response createPOMaster(POMasterRequest request)
|
||||
throws AstuteException, ParseException {
|
||||
String dateStr = request.getPODate();
|
||||
Date date = null;
|
||||
if (dateStr != null) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
date = new java.sql.Date(df.parse(dateStr).getTime());
|
||||
}
|
||||
|
||||
POService.createPOMaster(request.getPoNum(), request.getContractNum(), date, request.getContractAmt(), request.getCustomerId(), request.getAstuteProjectNumber(),request.getTitle());
|
||||
POService.createPOMaster(request.getPoNum(), request.getContractNum(), request.getPODate(), request.getContractAmt(), request.getCustomerId(), request.getAstuteProjectNumber(),request.getTitle());
|
||||
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
|
||||
}
|
||||
@Path("/detail")
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.astute.model.PODetail;
|
|||
|
||||
import java.sql.Date;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.astute.dao.DAO.getDao;
|
||||
|
@ -15,7 +16,7 @@ public class POService extends Service{
|
|||
super();
|
||||
}
|
||||
|
||||
public List<PO> getPOMaster(String PONum, String contractNum, Date PODate, String astuteProjectNumber)
|
||||
public List<PO> getPOMaster(String PONum, String contractNum, String PODate, String astuteProjectNumber)
|
||||
throws AstuteException {
|
||||
return getDao().getPOMaster(PONum, contractNum, PODate, astuteProjectNumber);
|
||||
}
|
||||
|
@ -27,8 +28,9 @@ public class POService extends Service{
|
|||
}
|
||||
|
||||
|
||||
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber, String title)
|
||||
public void updatePOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String astuteProjectNumber, String title)
|
||||
throws AstuteException {
|
||||
System.out.print("PODate in Service is "+ PODate);
|
||||
getDao().updatePOMaster(PONum, contractNum, PODate, contractAmt, astuteProjectNumber, title);
|
||||
}
|
||||
|
||||
|
@ -37,8 +39,8 @@ public class POService extends Service{
|
|||
getDao().updatePODetail(POnum, lineItemNo, serviceDesc, feeTypeId, qty, fee, serviceTypeId, remainingQuantity);
|
||||
}
|
||||
|
||||
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title)
|
||||
throws AstuteException {
|
||||
public void createPOMaster(String PONum, String contractNum, String PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title)
|
||||
throws AstuteException, ParseException {
|
||||
getDao().createPOMaster(PONum, contractNum, PODate, contractAmt, customerId, astuteProjectNumber, title);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user