mirror of
https://github.com/dyiop/astute.git
synced 2025-04-05 21:10:16 -04:00
Added draft Remaining Qty
This commit is contained in:
parent
3d38651747
commit
12748b8035
|
@ -755,6 +755,20 @@ DECLARE CONTINUE HANDLER FOR NOT FOUND SET p_finished = 1;
|
||||||
END//
|
END//
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
CREATE FUNCTION astute.`get_draft_remaining_qty_fun`(inv_num_in varchar(40), item_no_in int) RETURNS double
|
||||||
|
BEGIN
|
||||||
|
DECLARE draft_qty double;
|
||||||
|
DECLARE ponum varchar(20);
|
||||||
|
DECLARE submitted_qty double;
|
||||||
|
DECLARE po_item_no_in int;
|
||||||
|
|
||||||
|
SELECT po_line_item_num into po_item_no_in from invoice_detail where inv_num = inv_num_in and line_item_num = item_no_in;
|
||||||
|
SELECT po_num into ponum from invoice where inv_no = inv_num_in;
|
||||||
|
SELECT sum(qty) into draft_qty from invoice_detail where inv_num = inv_num_in and po_line_item_num = po_item_no_in;
|
||||||
|
SELECT remaining_qty into submitted_qty from po_detail where PO_num = ponum and line_item_no = po_item_no_in;
|
||||||
|
return submitted_qty-draft_qty;
|
||||||
|
END;
|
||||||
|
|
||||||
-- Dumping structure for function astute.update_remaining_qty_fun
|
-- Dumping structure for function astute.update_remaining_qty_fun
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE DEFINER=`root`@`localhost` FUNCTION `update_remaining_qty_fun`(po_no_in varchar(40), inv_num_in varchar(40), item_no_in int) RETURNS double
|
CREATE DEFINER=`root`@`localhost` FUNCTION `update_remaining_qty_fun`(po_no_in varchar(40), inv_num_in varchar(40), item_no_in int) RETURNS double
|
||||||
|
|
|
@ -485,7 +485,13 @@ public class SqlDAO extends DAO {
|
||||||
PO po = getPOMaster(PONo, null, null, null).get(0);
|
PO po = getPOMaster(PONo, null, null, null).get(0);
|
||||||
String customerId = po.getCustomerId();
|
String customerId = po.getCustomerId();
|
||||||
Customer customer = getCustomers(customerId).get(0);
|
Customer customer = getCustomers(customerId).get(0);
|
||||||
|
|
||||||
Double previouslyBilledAmt = getPreviouslyBilledAmount(PONo);
|
Double previouslyBilledAmt = getPreviouslyBilledAmount(PONo);
|
||||||
|
|
||||||
|
if (invoice.getInvoiceStatus()==2) {
|
||||||
|
// TODO substract current invoice's bill amount from previouslyBilledAmt
|
||||||
|
// if it is a submitted invoice
|
||||||
|
}
|
||||||
Double toBeBilledAmt = po.getContractAmt() - previouslyBilledAmt - invoice.getBillAmt();
|
Double toBeBilledAmt = po.getContractAmt() - previouslyBilledAmt - invoice.getBillAmt();
|
||||||
generatedInvoice = new GeneratedInvoice(invoice, invoiceDetail, po, customer, previouslyBilledAmt, toBeBilledAmt );
|
generatedInvoice = new GeneratedInvoice(invoice, invoiceDetail, po, customer, previouslyBilledAmt, toBeBilledAmt );
|
||||||
return generatedInvoice;
|
return generatedInvoice;
|
||||||
|
@ -541,7 +547,7 @@ public class SqlDAO extends DAO {
|
||||||
try {
|
try {
|
||||||
List<InvoiceDetail> services = new ArrayList<>();
|
List<InvoiceDetail> services = new ArrayList<>();
|
||||||
Statement stmt = conn.createStatement();
|
Statement stmt = conn.createStatement();
|
||||||
String sql = "SELECT inv_num, line_item_num, PO_line_item_num, service_type_id, description, fee_type_id, fee, qty FROM INVOICE_DETAIL ";
|
String sql = "SELECT inv_num, line_item_num, PO_line_item_num, service_type_id, description, fee_type_id, fee, qty, get_draft_remaining_qty_fun('"+invoiceNum+"',"+ lineItemNo + ") as draftRemainingQty FROM INVOICE_DETAIL ";
|
||||||
|
|
||||||
String whereClause = " WHERE ";
|
String whereClause = " WHERE ";
|
||||||
boolean whereClauseIndicator = false;
|
boolean whereClauseIndicator = false;
|
||||||
|
@ -567,7 +573,8 @@ public class SqlDAO extends DAO {
|
||||||
int feeTypeId = rs.getInt(6);
|
int feeTypeId = rs.getInt(6);
|
||||||
Double fee = rs.getDouble(7);
|
Double fee = rs.getDouble(7);
|
||||||
Double qty = rs.getDouble(8);
|
Double qty = rs.getDouble(8);
|
||||||
InvoiceDetail service = new InvoiceDetail(invNo, lineItemNum, POLineItemNum, serviceTypeId, desc, qty, fee, feeTypeId);
|
Double draftRemainingQty = rs.getDouble(9);
|
||||||
|
InvoiceDetail service = new InvoiceDetail(invNo, lineItemNum, POLineItemNum, serviceTypeId, desc, qty, fee, feeTypeId,draftRemainingQty);
|
||||||
services.add(service);
|
services.add(service);
|
||||||
}
|
}
|
||||||
return services;
|
return services;
|
||||||
|
|
|
@ -9,8 +9,9 @@ public class InvoiceDetail {
|
||||||
double qty;
|
double qty;
|
||||||
double fee;
|
double fee;
|
||||||
int feeTypeId;
|
int feeTypeId;
|
||||||
|
double draftRemainingQty;
|
||||||
|
|
||||||
public InvoiceDetail(String invoiceNum, int lineItemNum, int poLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId) {
|
public InvoiceDetail(String invoiceNum, int lineItemNum, int poLineItemNum, int serviceTypeId, String desc, double qty, double fee, int feeTypeId, double draftRemainingQty) {
|
||||||
this.invoiceNum = invoiceNum;
|
this.invoiceNum = invoiceNum;
|
||||||
this.lineItemNum = lineItemNum;
|
this.lineItemNum = lineItemNum;
|
||||||
this.poLineItemNum = poLineItemNum;
|
this.poLineItemNum = poLineItemNum;
|
||||||
|
@ -19,6 +20,7 @@ public class InvoiceDetail {
|
||||||
this.qty = qty;
|
this.qty = qty;
|
||||||
this.fee = fee;
|
this.fee = fee;
|
||||||
this.feeTypeId = feeTypeId;
|
this.feeTypeId = feeTypeId;
|
||||||
|
this.draftRemainingQty = draftRemainingQty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInvoiceNum() {
|
public String getInvoiceNum() {
|
||||||
|
@ -84,4 +86,12 @@ public class InvoiceDetail {
|
||||||
public void setFeeTypeId(int feeTypeId) {
|
public void setFeeTypeId(int feeTypeId) {
|
||||||
this.feeTypeId = feeTypeId;
|
this.feeTypeId = feeTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getDraftRemainingQty() {
|
||||||
|
return draftRemainingQty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDraftRemainingQty(double draftRemainingQty) {
|
||||||
|
this.draftRemainingQty = draftRemainingQty;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user