Commit 16fedc73 authored by steurwadkar's avatar steurwadkar

Min Rate insert for quantity and quantity_adj


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104308 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2485309e
......@@ -3421,6 +3421,8 @@ public class PostOrderActivity {
ArrayList <String> schemeKeyList= new ArrayList<String>();
boolean periodScheme = false;
String prevRefNo = "";
//Added by Santosh on 04/01/17
double invQty = 0.0;
try
{
// 06-Dec-16 manoharan moved from inside loop
......@@ -3433,7 +3435,9 @@ public class PostOrderActivity {
{
llSchemeNum = Long.parseLong(lsVarValue);
lbChkNull = false;
for (int llCtrSch = 1; llCtrSch < llSchemeNum; llCtrSch++) // FOR LOOP [1]
//Changed by Santosh on 04/01/17 to change condition in for loop
//for (int llCtrSch = 1; llCtrSch < llSchemeNum; llCtrSch++) // FOR LOOP [1]
for (int llCtrSch = 1; llCtrSch <= llSchemeNum; llCtrSch++) // FOR LOOP [1]
{
lsScheme = "SCHEME_HIST_KEY" + llCtrSch;
lsVarValue = distCommon.getDisparams("999999", lsScheme, conn);
......@@ -3821,10 +3825,18 @@ public class PostOrderActivity {
} else if (lsColnameStr.trim().equalsIgnoreCase("cust_code"))
{
lsDocValue = lsDocValue + ',' + custCode.trim();
} else if (lsColnameStr.trim().equalsIgnoreCase("cust_code__bil"))
}
else if (lsColnameStr.trim().equalsIgnoreCase("cust_code__bil"))
{
lsDocValue = lsDocValue + ',' + custCodeBill.trim();
} else if (lsColnameStr.trim().equalsIgnoreCase("lot_no") || lsColnameStr.trim().equalsIgnoreCase("item_code"))
}
//Added by Santosh on 04/01/17 to add Invoice Id in the doc key [Start]
else if (lsColnameStr.trim().equalsIgnoreCase("invoice_id"))
{
lsDocValue = lsDocValue + ',' + invoiceId.trim();
}
//Added by Santosh on 04/01/17 to add Invoice Id in the doc key [End]
else if (lsColnameStr.trim().equalsIgnoreCase("lot_no") || lsColnameStr.trim().equalsIgnoreCase("item_code"))
{
if ("R".equalsIgnoreCase(tranType))
{
......@@ -3916,7 +3928,9 @@ public class PostOrderActivity {
}
}
}
lsDocValue = lsDocValue + "," + xFldValue;
//Changed by Santosh on 03/01/17 to trim xFldValue
//lsDocValue = lsDocValue + "," + xFldValue;
lsDocValue = lsDocValue + "," + xFldValue.trim();
} else
{
if ("R".equalsIgnoreCase(tranType))
......@@ -4023,6 +4037,27 @@ public class PostOrderActivity {
itemCodeOrd = lsSchemeCode;
}
}
//Added by Santosh on 04/01/17 to get invoice qty from invoice[Start]
sql = "SELECT SUM(QUANTITY) FROM INVDET WHERE INVOICE_ID = ? AND ITEM_CODE = ? GROUP BY ITEM_CODE";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, invoiceId);
pstmt2.setString(2, itemCode);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
invQty = rs2.getDouble("QUANTITY");
}
if(pstmt2!=null)
{
pstmt2.close();
pstmt2 = null;
}
if(rs2 != null)
{
rs2.close();
rs2 = null;
}
//Added by Santosh on 04/01/17 to get invoice qty from invoice[End]
if (ldEffCost < rate && ldEffCost != 0)
{
sql = "select count(*) as cnt from min_rate_history where doc_key = ?";
......@@ -4041,8 +4076,8 @@ public class PostOrderActivity {
if (cnt == 0)
{
sql = "insert into min_rate_history (doc_key, eff_cost, scheme_code, invoice_id, invoice_date, cust_code, item_code,"
+ " site_code, lot_no, returnable,reas_code, chg_date, chg_user, chg_term )"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ " site_code, lot_no, returnable,reas_code, chg_date, chg_user, chg_term, quantity, quantity_adj )"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, lsDocValue);
pstmt2.setDouble(2, ldEffCost);
......@@ -4058,6 +4093,10 @@ public class PostOrderActivity {
pstmt2.setTimestamp(12, chgDate);
pstmt2.setString(13, logInCode);
pstmt2.setString(14, termId);
//Added by Santosh on 04/01/17 to insert qty and qty_adj [Start]
pstmt2.setDouble(15, invQty);
pstmt2.setDouble(16, 0.0);
//Added by Santosh on 04/01/17 to insert qty and qty_adj End]
cnt = pstmt2.executeUpdate();
pstmt2.close();
......@@ -4117,8 +4156,8 @@ public class PostOrderActivity {
if (ldEffCost != 0)
{
sql = "insert into min_rate_history (doc_key, eff_cost, scheme_code, invoice_id, invoice_date, cust_code,"
+ " item_code, site_code, lot_no, returnable,reas_code, chg_date, chg_user, chg_term )"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ " item_code, site_code, lot_no, returnable,reas_code, chg_date, chg_user, chg_term, quantity, quantity_adj )"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, lsDocValue);
pstmt2.setDouble(2, ldEffCost);
......@@ -4134,6 +4173,10 @@ public class PostOrderActivity {
pstmt2.setTimestamp(12, chgDate);
pstmt2.setString(13, logInCode);
pstmt2.setString(14, termId);
//Added by Santosh on 04/01/17 to insert qty and qty_adj [Start]
pstmt2.setDouble(15, invQty);
pstmt2.setDouble(16, 0.0);
//Added by Santosh on 04/01/17 to insert qty and qty_adj End]
cnt = pstmt2.executeUpdate();
pstmt2.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment