mirror of
https://github.com/dyiop/astute.git
synced 2025-04-05 13:00:16 -04:00
* Created deleteInvoiceDetail and deletePODetail Angular service methods.
* Web Service - Took out Invoice Detail remaining qty check from WS code. It will be handled in Front end now.
This commit is contained in:
parent
818bf35e9f
commit
3d38651747
|
@ -375,6 +375,30 @@ export class AstuteClientService {
|
|||
this.notif(error);
|
||||
});
|
||||
}
|
||||
public deletePODetail(ponum, lineItemNo) {
|
||||
console.log('*** In deletePODetail()');
|
||||
const sessionId = localStorage.getItem('sessionId');
|
||||
const url = `${this.POUrl}/detail/${ponum}/${lineItemNo}${this.sessionString}`;
|
||||
return this.http.delete(url)
|
||||
.toPromise()
|
||||
.then(response => {
|
||||
const code = response['code'];
|
||||
const message = response['message'];
|
||||
if (code === 9000) {
|
||||
console.log(response['entity']);
|
||||
return response['entity'];
|
||||
} else if (message.includes('login')) {
|
||||
this.notif('Please login again!');
|
||||
} else {
|
||||
this.notif('Delete Sales Order Details Failed: ' + message);
|
||||
}
|
||||
}, (reason) => {
|
||||
this.notif('Delete Sales Order Details Failed: ' + reason);
|
||||
})
|
||||
.catch( error => {
|
||||
this.notif(error);
|
||||
});
|
||||
}
|
||||
public createPODetail(data) {
|
||||
console.log('*** In createPODetail()');
|
||||
const url = `${this.POUrl}/detail${this.sessionString}`;
|
||||
|
@ -722,6 +746,29 @@ export class AstuteClientService {
|
|||
this.notif(error);
|
||||
});
|
||||
}
|
||||
public deleteInvoiceDetail(invNum, lineItemNo) {
|
||||
console.log('*** In deleteInvoiceDetail()');
|
||||
const url = `${this.invoiceUrl}/detail/${invNum}/${lineItemNo}${this.sessionString}`;
|
||||
return this.http.delete(url)
|
||||
.toPromise()
|
||||
.then(response => {
|
||||
const code = response['code'];
|
||||
const message = response['message'];
|
||||
if (code === 9000) {
|
||||
console.log(response['entity']);
|
||||
return response['entity'];
|
||||
} else if (message.includes('login')) {
|
||||
this.notif('Please login again!');
|
||||
} else {
|
||||
this.notif('Delete Invoice Detail Failed: ' + message);
|
||||
}
|
||||
}, (reason) => {
|
||||
this.notif('Delete Invoice Detail Failed: ' + reason);
|
||||
})
|
||||
.catch( error => {
|
||||
this.notif(error);
|
||||
});
|
||||
}
|
||||
public createInvoiceDetail(data) {
|
||||
console.log('*** In createInvoiceDetail()');
|
||||
const url = `${this.invoiceUrl}/detail${this.sessionString}`;
|
||||
|
|
|
@ -635,6 +635,31 @@ public class SqlDAO extends DAO {
|
|||
}
|
||||
}
|
||||
|
||||
public Double getRemainingQty(String poNum, String invoiceNum, int lineItemNo) throws AstuteException {
|
||||
Double remainingQty=0.0;
|
||||
String sql;
|
||||
try {
|
||||
Statement stmt = conn.createStatement();
|
||||
if (!poNum.isEmpty()) {
|
||||
sql = "SELECT remaining_qty FROM PO_DETAIL WHERE po_Num = '" + poNum + "' AND line_item_no = " + lineItemNo;
|
||||
} else {
|
||||
sql = " SELECT remaining_qty FROM PO_DETAIL, INVOICE " +
|
||||
" WHERE invoice.PO_num = po_detail.PO_num " +
|
||||
" AND line_item_no = " + lineItemNo +
|
||||
" AND invoice.inv_no = '" + invoiceNum + "'";
|
||||
}
|
||||
System.out.println(sql);
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
remainingQty = rs.getDouble(1);
|
||||
}
|
||||
return remainingQty;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
throw new AstuteException(DB_ERROR,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Double updateRemainingQty(String poNum, String invNo, int lineItemNo) throws AstuteException {
|
||||
Double remainingQty;
|
||||
try {
|
||||
|
@ -654,8 +679,12 @@ public class SqlDAO extends DAO {
|
|||
}
|
||||
return remainingQty;
|
||||
}
|
||||
|
||||
public void updateInvoiceDetail(String invoiceNum, int lineItemNum, int POLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId)throws AstuteException {
|
||||
try {
|
||||
// if (qty > getRemainingQty( "",invoiceNum, POLineItemNum)) {
|
||||
// throw new AstuteException(DB_ERROR,"Qty can not exceed Remaining Qty");
|
||||
// }
|
||||
String sql = "UPDATE INVOICE_DETAIL ";
|
||||
String updateClause = " SET ";
|
||||
String whereClause = "";
|
||||
|
|
Loading…
Reference in New Issue
Block a user