Commit 2114402b authored by manohar's avatar manohar

bug fix VTCRAMT validation and loc_code set properly for status N


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91266 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0d9f17ee
...@@ -417,9 +417,9 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -417,9 +417,9 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
java.sql.Timestamp currDate = null; java.sql.Timestamp currDate = null;
currDate = new java.sql.Timestamp(System.currentTimeMillis()) ; currDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
currAppdate = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(currDate).toString(); currAppdate = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(currDate).toString();
valueXmlString.append("<eff_date protect =\"1\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</eff_date>"); valueXmlString.append("<eff_date protect =\"0\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</eff_date>");
valueXmlString.append("<tran_date protect =\"1\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</tran_date>"); valueXmlString.append("<tran_date protect =\"0\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</tran_date>");
valueXmlString.append("<tax_date protect =\"1\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</tax_date>"); valueXmlString.append("<tax_date protect =\"0\">").append("<![CDATA["+currAppdate.trim()+"]]>").append("</tax_date>");
priceListClgYn = distCommon.getDisparams("999999","PRICE_LIST__CLG_YN",conn); priceListClgYn = distCommon.getDisparams("999999","PRICE_LIST__CLG_YN",conn);
priceListClgYn = priceListClgYn == null ?"" : priceListClgYn.trim(); priceListClgYn = priceListClgYn == null ?"" : priceListClgYn.trim();
...@@ -2144,6 +2144,10 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -2144,6 +2144,10 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
// 20/04/10 manoharan
itemRef = itemRef == null ?"" : itemRef.trim();
descr = descr == null ?"" : descr.trim();
// end 20/04/10 manoharan
valueXmlString.append("<cust_item__ref>").append("<![CDATA[" + itemRef + "]]>").append("</cust_item__ref>"); valueXmlString.append("<cust_item__ref>").append("<![CDATA[" + itemRef + "]]>").append("</cust_item__ref>");
setNodeValue( dom, "cust_item__ref", itemRef ); setNodeValue( dom, "cust_item__ref", itemRef );
valueXmlString.append("<cust_item_ref_descr>").append("<![CDATA[" + descr + "]]>").append("</cust_item_ref_descr>"); valueXmlString.append("<cust_item_ref_descr>").append("<![CDATA[" + descr + "]]>").append("</cust_item_ref_descr>");
...@@ -2742,7 +2746,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -2742,7 +2746,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
if (!locCode.equals("NULLFOUND")) if (!locCode.equals("NULLFOUND"))
{ {
valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>"); valueXmlString.append("<loc_code>").append("<![CDATA[" + locCode + "]]>").append("</loc_code>");
sql = "descr from location where loc_code = ? "; sql = "select descr from location where loc_code = ? ";
pstmt= conn.prepareStatement( sql ); pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, locCode); pstmt.setString( 1, locCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -3651,6 +3655,15 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -3651,6 +3655,15 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
if( mexpDate.before( mchkDate ) ) if( mexpDate.before( mchkDate ) )
{ {
valueXmlString.append("<status>").append("<![CDATA[" + "N" + "]]>").append("</status>"); valueXmlString.append("<status>").append("<![CDATA[" + "N" + "]]>").append("</status>");
// 22/04/10 manoharan to set the loc_code accordingly
setNodeValue( dom, "status", "N" );
reStr = itemChanged(dom, dom1, dom2, objContext, "status", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail2>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
// end 22/04/10 manoharan to set the loc_code accordingly
} }
}else }else
{ {
...@@ -3662,6 +3675,15 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -3662,6 +3675,15 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
if( lsDamagedtype != null && lsTrantype != null && lsDamagedtype.trim().equalsIgnoreCase( lsTrantype.trim() ) ) if( lsDamagedtype != null && lsTrantype != null && lsDamagedtype.trim().equalsIgnoreCase( lsTrantype.trim() ) )
{ {
valueXmlString.append("<status>").append("<![CDATA[" + "D" + "]]>").append("</status>"); valueXmlString.append("<status>").append("<![CDATA[" + "D" + "]]>").append("</status>");
// 22/04/10 manoharan to set the loc_code accordingly
setNodeValue( dom, "status", "D" );
reStr = itemChanged(dom, dom1, dom2, objContext, "status", editFlag, xtraParams);
pos = reStr.indexOf("<Detail2>");
reStr = reStr.substring(pos + 9);
pos = reStr.indexOf("</Detail2>");
reStr = reStr.substring(0,pos);
valueXmlString.append(reStr);
// end 22/04/10 manoharan to set the loc_code accordingly
//dw_detedit[ii_currformno].setitem(1,"status",'D') //dw_detedit[ii_currformno].setitem(1,"status",'D')
} }
} }
...@@ -4545,10 +4567,10 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4545,10 +4567,10 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{ {
mcode = genericUtility.getColumnValue( currentColumn.trim(), dom ); //dw_detedit[ii_currformno].GetItemString(1, colname) mcode = genericUtility.getColumnValue( currentColumn.trim(), dom ); //dw_detedit[ii_currformno].GetItemString(1, colname)
valStr = genericUtility.getColumnValue( "unit__std", dom ); unitStd = genericUtility.getColumnValue( "unit__std", dom );
valStr = valStr == null || valStr.trim().length() == 0 ? "0" : valStr.trim(); unitStd = unitStd == null || unitStd.trim().length() == 0 ? "0" : unitStd.trim();
mVal1 = Double.parseDouble( valStr ); //dw_detedit[ii_currformno].GetItemString(1, "unit__std") // 20/04/10 manoharan mVal1 = Double.parseDouble( valStr ); //dw_detedit[ii_currformno].GetItemString(1, "unit__std")
mitem = genericUtility.getColumnValue( "item_code", dom ); // dw_detedit[ii_currformno].GetItemString(1, "item_code") mitem = genericUtility.getColumnValue( "item_code", dom ); // dw_detedit[ii_currformno].GetItemString(1, "item_code")
valStr = genericUtility.getColumnValue( "quantity", dom ); valStr = genericUtility.getColumnValue( "quantity", dom );
...@@ -4557,7 +4579,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -4557,7 +4579,7 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
mNum1 = Double.parseDouble( valStr ); // dw_detedit[ii_currformno].getitemnumber(1, "quantity") mNum1 = Double.parseDouble( valStr ); // dw_detedit[ii_currformno].getitemnumber(1, "quantity")
mNum2 = 0; mNum2 = 0;
mNum = Double.parseDouble( distCommon.convQtyFactor(mcode, Double.toString( mVal1 ) , mitem, mNum1, mNum2, conn ).get(1).toString() ); mNum = Double.parseDouble( distCommon.convQtyFactor(mcode, unitStd , mitem, mNum1, mNum2, conn ).get(1).toString() );
valueXmlString.append("<conv__qty_stduom>").append("<![CDATA["+ mNum2 +"]]>").append("</conv__qty_stduom>"); valueXmlString.append("<conv__qty_stduom>").append("<![CDATA["+ mNum2 +"]]>").append("</conv__qty_stduom>");
//dw_detedit[ii_currformno].SetItem(1,"conv__qty_stduom", mNum2 ); //dw_detedit[ii_currformno].SetItem(1,"conv__qty_stduom", mNum2 );
...@@ -6868,8 +6890,8 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -6868,8 +6890,8 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
System.out.println( "lcAdjAmt :: " + lcAdjAmt ); System.out.println( "lcAdjAmt :: " + lcAdjAmt );
System.out.println( "lcQty :: " + lcQty ); System.out.println( "lcQty :: " + lcQty );
System.out.println( "lcRate :: " + lcRate ); System.out.println( "lcRate :: " + lcRate );
//lcAmount = (lcQty * lcRate) + lcAdjAmt; lcAmount = (lcQty * lcRate) + lcAdjAmt; // 22/04/10 manoharan uncommented
lcAmount = getTotAmt( dom2 ) + lcAdjAmt; //lcAmount = getTotAmt( dom2 ) + lcAdjAmt; // 22/04/10 manoharan commented
System.out.println( "lcInvtraceAmt :: " + lcInvtraceAmt ); System.out.println( "lcInvtraceAmt :: " + lcInvtraceAmt );
System.out.println( "lcAmount :: " + lcAmount ); System.out.println( "lcAmount :: " + lcAmount );
...@@ -6932,11 +6954,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -6932,11 +6954,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
{ {
lsItemCode = genericUtility.getColumnValue( "cust_item__ref", dom ); lsItemCode = genericUtility.getColumnValue( "cust_item__ref", dom );
mcustcode = genericUtility.getColumnValue( "cust_code", dom1 ); mcustcode = genericUtility.getColumnValue( "cust_code", dom1 );
if( lsItemCode != null && lsItemCode.trim().length() > 0 ) if( lsItemCode != null && lsItemCode.trim().length() > 0 && !"null".equals(lsItemCode))
{ {
sqlStr = " select count(*) mitem_cnt from customeritem " sqlStr = " select count(*) mitem_cnt from customeritem "
+" where cust_code = ? " //:mcustcode +" where cust_code = ? " //:mcustcode
+" and item_code__ref = ? "; //:ls_item_code ; +" and item_code__ref = ? "; //:ls_item_code ;
pstmt = conn.prepareStatement( sqlStr ); pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, mcustcode ); pstmt.setString( 1, mcustcode );
...@@ -7653,8 +7675,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -7653,8 +7675,11 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
String unitFrom = null, unitTo = null; String unitFrom = null, unitTo = null;
DistCommon distCommon = new DistCommon(); DistCommon distCommon = new DistCommon();
java.util.Date date = null; java.util.Date date = null;
ArrayList convList = null;
double packSize = 0;
String sql = null; String sql = null;
int prec = 3;
try try
{ {
...@@ -7744,21 +7769,23 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -7744,21 +7769,23 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
if (qtyVal > stkQty) if (qtyVal > stkQty)
{ {
balAmt = balAmt - (stkQty * rate); balAmt = balAmt - (stkQty * rate);
balAmt = getRequiredDecimal( balAmt, 4 ); balAmt = getRequiredDecimal( balAmt, prec );
quantity = quantity + stkQty; quantity = quantity + stkQty;
quantity = getRequiredDecimal( quantity, 4 ); quantity = getRequiredDecimal( quantity, prec );
} }
else else
{ {
quantity = quantity + qtyVal; quantity = quantity + qtyVal;
quantity = getRequiredDecimal( quantity, 4 ); quantity = getRequiredDecimal( quantity, prec );
break; break;
} }
System.out.println("quantity :: "+quantity); System.out.println("quantity :: "+quantity);
} }
} }
System.out.println("quantity :: "+quantity); System.out.println("quantity :: "+quantity);
quantity = getReqDecimal(quantity,prec);
System.out.println("quantity after :: "+quantity);
rs.close(); rs.close();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -7775,6 +7802,25 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -7775,6 +7802,25 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
if(rs.next()) if(rs.next())
{ {
unitPack = rs.getString(1); unitPack = rs.getString(1);
// 21/04/10 manoharan if item lot pack size defined then only convert
// moved from down
if (!unit.trim().equals(unitPack.trim()))
{
//conv = distCommon.convertBox(itemCode, unitPack, unit);
//gf_conv_qty( asUnitFrom, asUnitTo, asItemCode,1);
//quantity = distCommon.convQtyFactor( unit.trim(), unitPack.trim(), itemCode, 1, conn );
// 21/04/10 manoharan instead of converting the same has to be rounded in multiplies of the conversion factor
//quantity = distCommon.convQtyFactor( unit.trim(), unitPack.trim(), itemCode, quantity, conn );
packSize = 0;
convList = distCommon.getConvQuantityFact(unitPack.trim(), unit.trim(), itemCode, quantity, packSize, conn);
packSize = Double.parseDouble((String) convList.get(0));
System.out.println("packSize :: "+packSize);
quantity = quantity - (quantity % packSize);
System.out.println("quantity after rounding :: "+quantity);
// end 21/04/10 manoharan instead of converting the same has to be rounded in multiplies of the conversion factor
//quantity = quantity - (quantity % conv);
}
// end 21/04/10 manoharan
} }
else else
{ {
...@@ -7784,14 +7830,16 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -7784,14 +7830,16 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
/* 21/04/10 manoharan if item lot pack size defined then only convert
// moved up
if (!unit.trim().equals(unitPack.trim())) if (!unit.trim().equals(unitPack.trim()))
{ {
//conv = distCommon.convertBox(itemCode, unitPack, unit); //conv = distCommon.convertBox(itemCode, unitPack, unit);
//gf_conv_qty( asUnitFrom, asUnitTo, asItemCode,1); //gf_conv_qty( asUnitFrom, asUnitTo, asItemCode,1);
//quantity = distCommon.convQtyFactor( unit.trim(), unitPack.trim(), itemCode, 1, conn ); //quantity = distCommon.convQtyFactor( unit.trim(), unitPack.trim(), itemCode, 1, conn );
quantity = distCommon.convQtyFactor( unit.trim(), unitPack.trim(), itemCode, quantity, conn ); quantity = distCommon.convQtyFactor( unit.trim(), unitPack.trim(), itemCode, quantity, conn );
//quantity = quantity - (quantity % conv); //quantity = quantity - (quantity % conv);
} } // end 21/04/10 manoharan*/
utilMethods = null; utilMethods = null;
distCommon = null; distCommon = null;
} }
...@@ -7803,6 +7851,18 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -7803,6 +7851,18 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
return quantity; return quantity;
} }
private double getReqDecimal(double actVal, int prec)
{
String fmtStr = "############0";
String strValue = null;
if (prec > 0)
{
fmtStr = fmtStr + "." + "000000000".substring(0, prec);
}
DecimalFormat decFormat = new DecimalFormat(fmtStr);
return Double.parseDouble(decFormat.format(actVal));
}
private StringBuffer GetSetQcReqd(Document dom, Document dom1, StringBuffer sBuff, Connection conn) throws Exception private StringBuffer GetSetQcReqd(Document dom, Document dom1, StringBuffer sBuff, Connection conn) throws Exception
{ {
String varValue = null, locCode = null, descr = null, retReplFlag = null; String varValue = null, locCode = null, descr = null, retReplFlag = null;
......
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