Merge remote-tracking branch 'origin/master'

# Conflicts:
#	AstuteClient2/src/app/services/astute-client-service.ts
This commit is contained in:
Akash Shah 2018-08-22 15:02:58 -04:00
commit aaf92fcfa1
11 changed files with 83 additions and 48 deletions

View File

@ -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, new)"
(click)="addPo(projNum.value, ponum.value, podate.value, customerid.value, contractnum.value, contractamt.value, potitle.value, new)"
>
Add
</button>
@ -201,13 +201,22 @@
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">PO Number</label>
<label class="col-sm-2 col-form-label">SO Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" placeholder="PO Number" [value]="selected.ponum" #ponum disabled>
<select class="form-control" [value]="selected.title" #customerid disabled>
<option *ngFor="let customer of customers" [value]="customer.title">{{customer.title}}
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">PO Date</label>
<label class="col-sm-2 col-form-label">SO Number</label>
<div class="col-sm-10">
<input type="text" class="form-control" placeholder="SO Number" [value]="selected.ponum" #ponum disabled>
</div>
</div>
<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>
</div>
@ -323,7 +332,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, edit)"
(click)="editPo(projNum.value, ponum.value, podate.value, contractnum.value, contractamt.value, potitle.value, edit)"
>
Update
</button>

View File

@ -19,6 +19,7 @@ export class SalesOrderComponent implements OnInit {
// {headerName: 'Customer ID', field: 'customerId'},
{headerName: 'Customer Name', field: 'customerName'},
{headerName: 'Contract Number', field: 'contractNum'},
{headerName: 'SO Title', field: 'title'},
{headerName: 'Contract Amount', field: 'contractAmt'},
{headerName: 'SO Date', field: 'podate'}
];
@ -31,14 +32,15 @@ export class SalesOrderComponent implements OnInit {
this.refreshData();
}
addPo(projNum, ponum, podate, customerid, contractnum, contractamt, ref) {
addPo(projNum, ponum, podate, customerid, contractnum, contractamt, title, ref ) {
const poData = {
"astuteProjectNumber": projNum,
"poNum": ponum,
"PODate": this.formatDate(new Date(podate)),
"customerId": customerid,
"contractNum": contractnum,
"contractAmt": contractamt,
"contractAmt": contractamt,
"title": title,
}
console.log (poData.PODate);
this.astuteClientService.createPO(poData).then((data) => {
@ -70,13 +72,14 @@ export class SalesOrderComponent implements OnInit {
}
}
editPo(projNum, ponum, podate, contractnum, contractamt, ref) {
editPo(projNum, ponum, podate, contractnum, contractamt, title, ref) {
const poData = {
"astuteProjectNumber": projNum,
"poNum": ponum,
"PODate": this.formatDate(new Date(podate)),
"contractNum": contractnum,
"contractAmt": contractamt,
"title": title,
}
console.log(poData);
this.astuteClientService.updatePO(ponum, poData).then((data) => {

View File

@ -188,7 +188,6 @@ export class AstuteClientService {
public getInvoiceDetail(invoiceId: string): Promise<any> {
console.log("*** In getInvoiceDetail()");
const url = `${this.invoiceDetailUrl}?invoiceNumber=${invoiceId}`;
console.log(url);
return this.http.get(url)
.toPromise()
.then(response => {

View File

@ -99,11 +99,12 @@ CREATE TABLE IF NOT EXISTS `customer` (
PRIMARY KEY (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.customer: ~3 rows (approximately)
-- Dumping data for table astute.customer: ~4 rows (approximately)
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` (`customer_id`, `customer_name`, `bill_to_dept`, `add1`, `add2`, `city`, `state`, `zip`, `zip_last_4`, `email`, `phone`, `fax`) VALUES
('1', 'test4565', 'test123', 'test123', 'null', 'test123', 'md', 20874, 0, 'null', 0, 0),
('2', 'test123', 'test123', 'test123', NULL, 'test123', 'md', 20874, 0, NULL, 0, 0),
('3', 'Hampton Road Transit', 'Accounts Payable', '3400 Victoria Blvd', '', 'Hampton', 'VA', 23661, 0, 'wcollins@hrtransit.org', 7572226000, 7572226000),
('test500', 'test500', 'test500', 'test500', 'test500', 'test500', 'md', 20874, 1234, 'Test@Test.com', 1231231233, 131231233);
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
@ -371,14 +372,15 @@ CREATE TABLE IF NOT EXISTS `po` (
CONSTRAINT `po_customer_id_fk` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping data for table astute.po: ~5 rows (approximately)
-- Dumping data for table astute.po: ~6 rows (approximately)
/*!40000 ALTER TABLE `po` DISABLE KEYS */;
INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`, `po_id`) VALUES
('EP2649247', 'test123', NULL, 30000.00, '1', 'null', 1),
('test12', 'test', '2018-07-11', 60000.00, '1', 'adf', 2),
('test3', 'test', '2018-07-12', 60000.00, '1', 'adf', 3),
('test5', 'test', '2018-07-13', 60000.00, '1', 'adf', 4),
('test500', 'test', NULL, 60000.00, 'Test500', 'test', 1);
INSERT INTO `po` (`PO_num`, `contract_num`, `PO_date`, `contract_amt`, `customer_id`, `astute_project_num`, `po_id`, `title`) VALUES
('EP2649247', 'test123', NULL, 30000.00, '1', 'null', 1, 'SO Dummy Title for Test123'),
('HRT-16-72046', '16-72046', NULL, 23360.00, '3', 'HRT-01-01', 1, 'SO Dummy Title for 16-72046 adding upto 200 characters ****************************'),
('test12', 'test', '2018-07-11', 60000.00, '1', 'adf', 2, 'SO Dummy Title for test'),
('test3', 'test', '2018-07-12', 60000.00, '1', 'adf', 3, 'SO Dummy Title for test'),
('test5', 'test', '2018-07-13', 60000.00, '1', 'adf', 4, 'SO Dummy Title for test'),
('test500', 'test', NULL, 60000.00, 'Test500', 'test', 1, 'SO Dummy Title for test');
/*!40000 ALTER TABLE `po` ENABLE KEYS */;
-- Dumping structure for table astute.po_detail
@ -399,13 +401,13 @@ CREATE TABLE IF NOT EXISTS `po_detail` (
-- Dumping data for table astute.po_detail: ~6 rows (approximately)
/*!40000 ALTER TABLE `po_detail` DISABLE KEYS */;
INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id`, `qty`, `service_type_id`, `fee`, `remaining_qty`) VALUES
('EP2649247', 1, 'test', 2, 38073, 1, NULL, NULL),
('EP2649247', 2, 'test', 2, 16345, 1, NULL, NULL),
('EP2649247', 3, 'test', 2, 4642, 2, NULL, NULL),
('EP2649247', 4, 'test', 2, 880, 4, NULL, NULL),
('EP2649247', 6, 'test', 2, 456, 1, NULL, NULL),
('EP2649247', 16, 'test', 1, 1555, 1, NULL, NULL);
INSERT INTO `po_detail` (`PO_num`, `line_item_no`, `service_desc`, `fee_type_id`, `qty`, `service_type_id`, `fee`, `remaining_qty`, `title`) VALUES
('EP2649247', 1, 'test', 2, 38073, 1, NULL, NULL, NULL),
('EP2649247', 2, 'test', 2, 16345, 1, NULL, NULL, NULL),
('EP2649247', 3, 'test', 2, 4642, 2, NULL, NULL, NULL),
('EP2649247', 4, 'test', 2, 880, 4, NULL, NULL, NULL),
('EP2649247', 6, 'test', 2, 456, 1, NULL, NULL, NULL),
('EP2649247', 16, 'test', 1, 1555, 1, NULL, NULL, NULL);
/*!40000 ALTER TABLE `po_detail` ENABLE KEYS */;
-- Dumping structure for table astute.service_type

View File

@ -96,11 +96,11 @@ public abstract class DAO {
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) 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 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) 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 createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId, Double remainingQuantity) throws AstuteException;

View File

@ -40,7 +40,7 @@ public class SqlDAO extends DAO {
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 FROM PO ";
String sql = "SELECT PO_num, contract_num, PO_date, customer_id, contract_amt, astute_project_num , title FROM PO ";
if (PONum != null && !PONum.isEmpty()) {
sql += "WHERE UPPER(PO_num) = '" + PONum.toUpperCase() + "'";
} else if (contractNum != null && !contractNum.isEmpty()) {
@ -59,7 +59,8 @@ public class SqlDAO extends DAO {
String customerId = rs.getString(4);
Double contractAmt = rs.getDouble(5);
String astuteProjectNum = rs.getString(6);
PO po = new PO(poNum, cntrctNum, poDate, customerId, contractAmt,astuteProjectNum);
String title = rs.getString(7);
PO po = new PO(poNum, cntrctNum, poDate, customerId, contractAmt,astuteProjectNum,title);
pos.add(po);
}
return pos;
@ -108,7 +109,7 @@ public class SqlDAO extends DAO {
}
}
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber) throws AstuteException {
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber, String title) throws AstuteException {
try {
String sql = "UPDATE PO ";
String updateClause = " SET ";
@ -123,6 +124,7 @@ public class SqlDAO extends DAO {
updateClause = updateClause + " PO_Date = STR_TO_DATE(" + PODate + ", '%Y-%m-%d')" + ",";
updateClause = updateClause + " contract_amt = " + contractAmt+ ",";
updateClause = updateClause + " astute_project_num = '" + astuteProjectNumber +"'";
updateClause = updateClause + " title = '" + title +"'";
sql = sql+ updateClause + whereClause;
System.out.println(sql);
Statement stmt = conn.createStatement();
@ -185,15 +187,16 @@ public class SqlDAO extends DAO {
}
}
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String customerId, String astuteProjectNumber) throws AstuteException {
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title) throws AstuteException {
try {
CallableStatement stmt = conn.prepareCall("{call create_PO(?,?,?,?,?,?)}");
CallableStatement stmt = conn.prepareCall("{call create_PO(?,?,?,?,?,?,?)}");
stmt.setString(1, PONum);
stmt.setString(2, contractNum);
stmt.setDate(3, PODate);
stmt.setDouble(4, contractAmt);
stmt.setString(5, customerId);
stmt.setString(6, astuteProjectNumber);
stmt.setString(7, title);
stmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
@ -536,8 +539,8 @@ public class SqlDAO extends DAO {
int zip = rs.getInt(8);
int ziplast4 = rs.getInt(9);
String email = rs.getString(10);
int phone = rs.getInt(11);
int fax = rs.getInt(12);
Long phone = rs.getLong(11);
Long fax = rs.getLong(12);
Customer customer = new Customer(customerID, customerName,billToDept, add1, add2, city, state, zip, ziplast4, email, phone, fax);
customers.add(customer);
}

View File

@ -13,10 +13,10 @@ public class Customer {
int zip;
int ziplast4;
String email;
int phone;
int fax;
Long phone;
Long fax;
public Customer(String customerId, String customerName, String billToDept, String add1, String add2, String city, String state, int zip, int ziplast4, String email, int phone, int fax) {
public Customer(String customerId, String customerName, String billToDept, String add1, String add2, String city, String state, int zip, int ziplast4, String email, Long phone, Long fax) {
this.customerId = customerId;
this.customerName = customerName;
this.billToDept = billToDept;
@ -111,19 +111,19 @@ public class Customer {
this.email = email;
}
public int getPhone() {
public Long getPhone() {
return phone;
}
public void setPhone(int phone) {
public void setPhone(Long phone) {
this.phone = phone;
}
public int getFax() {
public Long getFax() {
return fax;
}
public void setFax(int fax) {
public void setFax(Long fax) {
this.fax = fax;
}
}

View File

@ -9,16 +9,18 @@ public class PO implements Serializable{
private String contractNum;
private Date PODate;
private Double contractAmt;
private String customerId;
private String customerId;
private String astuteProjectNumber;
private String title;
public PO(String PONum, String contractNum, Date PODate, String customerId, Double contractAmt, String astuteProjectNum) {
public PO(String PONum, String contractNum, Date PODate, String customerId, Double contractAmt, String astuteProjectNum, String title) {
this.PONum = PONum;
this.contractNum = contractNum;
this.PODate = PODate;
this.customerId = customerId;
this.contractAmt = contractAmt;
this.astuteProjectNumber = astuteProjectNum;
this.title = title;
}
@ -71,4 +73,12 @@ public class PO implements Serializable{
public void setAstuteProjectNumber(String astuteProjectNumber) {
this.astuteProjectNumber = astuteProjectNumber;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -10,6 +10,7 @@ public class POMasterRequest {
Double contractAmt;
String customerId;
String astuteProjectNumber;
String title;
public String getPoNum() {
return poNum;
@ -58,4 +59,12 @@ public class POMasterRequest {
public void setAstuteProjectNumber(String astuteProjectNumber) {
this.astuteProjectNumber = astuteProjectNumber;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -54,7 +54,7 @@ public class POResource {
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());
POService.updatePOMaster(PONum, request.getContractNum(), date, request.getContractAmt(), request.getAstuteProjectNumber(), request.getTitle());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@ -77,7 +77,7 @@ public class POResource {
date = new java.sql.Date(df.parse(dateStr).getTime());
}
POService.createPOMaster(request.getPoNum(), request.getContractNum(), date, request.getContractAmt(), request.getCustomerId(), request.getAstuteProjectNumber());
POService.createPOMaster(request.getPoNum(), request.getContractNum(), date, request.getContractAmt(), request.getCustomerId(), request.getAstuteProjectNumber(),request.getTitle());
return new ApiResponse(ApiResponse.UPDATE_ACCESS_SUCESS).toResponse();
}
@Path("/detail")

View File

@ -27,9 +27,9 @@ public class POService extends Service{
}
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber)
public void updatePOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String astuteProjectNumber, String title)
throws AstuteException {
getDao().updatePOMaster(PONum, contractNum, PODate, contractAmt, astuteProjectNumber);
getDao().updatePOMaster(PONum, contractNum, PODate, contractAmt, astuteProjectNumber, title);
}
public void updatePODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId, Double remainingQuantity)
@ -37,9 +37,9 @@ 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)
public void createPOMaster(String PONum, String contractNum, Date PODate, Double contractAmt, String customerId, String astuteProjectNumber, String title)
throws AstuteException {
getDao().createPOMaster(PONum, contractNum, PODate, contractAmt, customerId, astuteProjectNumber);
getDao().createPOMaster(PONum, contractNum, PODate, contractAmt, customerId, astuteProjectNumber, title);
}
public void createPODetail(String POnum, int lineItemNo, String serviceDesc, int feeTypeId, Double qty, Double fee, int serviceTypeId, Double remainingQuantity)