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 { ...@@ -3421,6 +3421,8 @@ public class PostOrderActivity {
ArrayList <String> schemeKeyList= new ArrayList<String>(); ArrayList <String> schemeKeyList= new ArrayList<String>();
boolean periodScheme = false; boolean periodScheme = false;
String prevRefNo = ""; String prevRefNo = "";
//Added by Santosh on 04/01/17
double invQty = 0.0;
try try
{ {
// 06-Dec-16 manoharan moved from inside loop // 06-Dec-16 manoharan moved from inside loop
...@@ -3433,7 +3435,9 @@ public class PostOrderActivity { ...@@ -3433,7 +3435,9 @@ public class PostOrderActivity {
{ {
llSchemeNum = Long.parseLong(lsVarValue); llSchemeNum = Long.parseLong(lsVarValue);
lbChkNull = false; 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; lsScheme = "SCHEME_HIST_KEY" + llCtrSch;
lsVarValue = distCommon.getDisparams("999999", lsScheme, conn); lsVarValue = distCommon.getDisparams("999999", lsScheme, conn);
...@@ -3821,10 +3825,18 @@ public class PostOrderActivity { ...@@ -3821,10 +3825,18 @@ public class PostOrderActivity {
} else if (lsColnameStr.trim().equalsIgnoreCase("cust_code")) } else if (lsColnameStr.trim().equalsIgnoreCase("cust_code"))
{ {
lsDocValue = lsDocValue + ',' + custCode.trim(); lsDocValue = lsDocValue + ',' + custCode.trim();
} else if (lsColnameStr.trim().equalsIgnoreCase("cust_code__bil")) }
else if (lsColnameStr.trim().equalsIgnoreCase("cust_code__bil"))
{ {
lsDocValue = lsDocValue + ',' + custCodeBill.trim(); 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)) if ("R".equalsIgnoreCase(tranType))
{ {
...@@ -3916,7 +3928,9 @@ public class PostOrderActivity { ...@@ -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 } else
{ {
if ("R".equalsIgnoreCase(tranType)) if ("R".equalsIgnoreCase(tranType))
...@@ -4023,6 +4037,27 @@ public class PostOrderActivity { ...@@ -4023,6 +4037,27 @@ public class PostOrderActivity {
itemCodeOrd = lsSchemeCode; 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) if (ldEffCost < rate && ldEffCost != 0)
{ {
sql = "select count(*) as cnt from min_rate_history where doc_key = ?"; sql = "select count(*) as cnt from min_rate_history where doc_key = ?";
...@@ -4041,8 +4076,8 @@ public class PostOrderActivity { ...@@ -4041,8 +4076,8 @@ public class PostOrderActivity {
if (cnt == 0) if (cnt == 0)
{ {
sql = "insert into min_rate_history (doc_key, eff_cost, scheme_code, invoice_id, invoice_date, cust_code, item_code," 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 )" + " site_code, lot_no, returnable,reas_code, chg_date, chg_user, chg_term, quantity, quantity_adj )"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt2 = conn.prepareStatement(sql); pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, lsDocValue); pstmt2.setString(1, lsDocValue);
pstmt2.setDouble(2, ldEffCost); pstmt2.setDouble(2, ldEffCost);
...@@ -4058,6 +4093,10 @@ public class PostOrderActivity { ...@@ -4058,6 +4093,10 @@ public class PostOrderActivity {
pstmt2.setTimestamp(12, chgDate); pstmt2.setTimestamp(12, chgDate);
pstmt2.setString(13, logInCode); pstmt2.setString(13, logInCode);
pstmt2.setString(14, termId); 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(); cnt = pstmt2.executeUpdate();
pstmt2.close(); pstmt2.close();
...@@ -4117,8 +4156,8 @@ public class PostOrderActivity { ...@@ -4117,8 +4156,8 @@ public class PostOrderActivity {
if (ldEffCost != 0) if (ldEffCost != 0)
{ {
sql = "insert into min_rate_history (doc_key, eff_cost, scheme_code, invoice_id, invoice_date, cust_code," 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 )" + " item_code, site_code, lot_no, returnable,reas_code, chg_date, chg_user, chg_term, quantity, quantity_adj )"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt2 = conn.prepareStatement(sql); pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, lsDocValue); pstmt2.setString(1, lsDocValue);
pstmt2.setDouble(2, ldEffCost); pstmt2.setDouble(2, ldEffCost);
...@@ -4134,6 +4173,10 @@ public class PostOrderActivity { ...@@ -4134,6 +4173,10 @@ public class PostOrderActivity {
pstmt2.setTimestamp(12, chgDate); pstmt2.setTimestamp(12, chgDate);
pstmt2.setString(13, logInCode); pstmt2.setString(13, logInCode);
pstmt2.setString(14, termId); 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(); cnt = pstmt2.executeUpdate();
pstmt2.close(); 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