Commit 164e382c authored by manohar's avatar manohar

in case invoice_id specified same rate picked


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@34957 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ec81c464
...@@ -3224,16 +3224,29 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -3224,16 +3224,29 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
lineNoTrace = genericUtility.getColumnValue("line_no__invtrace", dom);
if (lineNoTrace != null )
{
if (lineNoTrace != null && lineNoTrace.indexOf(".") > 0)
{
lineNoTrace = lineNoTrace.substring(0,lineNoTrace.indexOf("."));
}
iLineNoTrace = Integer.parseInt( lineNoTrace );
}
sql = "select sum((case when quantity is null then 0 else quantity end) * " sql = "select sum((case when quantity is null then 0 else quantity end) * "
+ " (case when rate is null then 0 else rate end)), " + " (case when rate is null then 0 else rate end)), "
+ " sum(case when quantity is null then 0 else quantity end) " + " sum(case when quantity is null then 0 else quantity end) "
+ " from invoice_trace " + " from invoice_trace "
+ " where invoice_id = ? " + " where invoice_id = ? "
+ " and inv_line_no = ? "; + " and line_no = ? ";
//+ " and inv_line_no = ? ";
pstmt= conn.prepareStatement( sql ); pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, invoiceId); pstmt.setString( 1, invoiceId);
pstmt.setInt( 2, lineNoInv ); //pstmt.setInt( 2, lineNoInv );
pstmt.setInt( 2, iLineNoTrace );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next() ) if( rs.next() )
{ {
...@@ -6110,15 +6123,17 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -6110,15 +6123,17 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
sqlStr = " select (sum(case when '" + fldName + "' ='rate' then rate else rate__stduom*conv__rtuom_stduom end * quantity) / sum(quantity) ) as lc_inv_rate " sqlStr = " select (sum(case when '" + fldName + "' ='rate' then rate else rate__stduom*conv__rtuom_stduom end * quantity) / sum(quantity) ) as lc_inv_rate "
+" from invoice_trace " +" from invoice_trace "
+" where invoice_id = ? " +" where invoice_id = ? "
+" and SORD_NO = ? " // + " and line_no = ? ";
+" and SORD_LINE_NO = ? " //+" and SORD_NO = ? " //
+ " and lot_no = ? "; // 14/07/14 manoharan consider lot_no as in case of issue from multiple lot_no the rate may become more //+" and SORD_LINE_NO = ? "
//+ " and lot_no = ? "; // 14/07/14 manoharan consider lot_no as in case of issue from multiple lot_no the rate may become more
pstmt = conn.prepareStatement( sqlStr ); pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, lsInvoiceId ); pstmt.setString( 1, lsInvoiceId );
pstmt.setString( 2, saleOrder ); pstmt.setInt( 2, llLineNoInvtrace );
pstmt.setString( 3, lineNoSord ); //pstmt.setString( 2, saleOrder );
pstmt.setString( 4, lsLotNo ); // 14/07/14 manoharan consider lot_no as in case of issue from multiple lot_no the rate may become more //pstmt.setString( 3, lineNoSord );
//pstmt.setString( 4, lsLotNo ); // 14/07/14 manoharan consider lot_no as in case of issue from multiple lot_no the rate may become more
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next() ) if( rs.next() )
{ {
...@@ -6135,24 +6150,24 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales ...@@ -6135,24 +6150,24 @@ public class SalesReturn extends ValidatorEJB implements SalesReturnLocal, Sales
lcRate = getReqDecimal(lcRate, 4); lcRate = getReqDecimal(lcRate, 4);
if ( lcRate > lcInvRate && lcInvRate > 0 ) if ( lcRate > lcInvRate && lcInvRate > 0 )
{ {
// 18/10/14 manoharan take care if specific lot rate < average rate //// 18/10/14 manoharan take care if specific lot rate < average rate
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><Detail2><editFlag>"); //StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><Detail2><editFlag>");
valueXmlString.append(editFlag).append("</editFlag>"); //valueXmlString.append(editFlag).append("</editFlag>");
StringBuffer minRateBuff = getMinRate( dom, dom1, "lot_no", valueXmlString, conn); //StringBuffer minRateBuff = getMinRate( dom, dom1, "lot_no", valueXmlString, conn);
System.out.println( "minRateBuff2 :: " + minRateBuff.toString() ); //System.out.println( "minRateBuff2 :: " + minRateBuff.toString() );
//valueXmlString = minRateBuff; ////valueXmlString = minRateBuff;
String rateValStr = getTagValue( minRateBuff.toString(), "rate" ); //String rateValStr = getTagValue( minRateBuff.toString(), "rate" );
System.out.println("manohar lcRateStr [" + lcRateStr + "] lcRate [" + lcRate + "] > lcInvRate [" + lcInvRate + "] avgRate [" + rateValStr + "]"); //System.out.println("manohar lcRateStr [" + lcRateStr + "] lcRate [" + lcRate + "] > lcInvRate [" + lcInvRate + "] avgRate [" + rateValStr + "]");
double avgRate = getRequiredDecimal( Double.parseDouble( getNumString( rateValStr ) ), 4 ); //double avgRate = getRequiredDecimal( Double.parseDouble( getNumString( rateValStr ) ), 4 );
if (avgRate < lcRate) //if (avgRate < lcRate)
{ //{
errCode = "VTINVRATE1"; errCode = "VTINVRATE1";
//errString = getErrorString( childNodeName, errCode, userId ); //errString = getErrorString( childNodeName, errCode, userId );
//break; //break;
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} //}
// end 18/10/14 manoharan take care if specific lot rate < average rate // end 18/10/14 manoharan take care if specific lot rate < average rate
} }
}//if isnull(ls_invoice_id) or len(trim(ls_invoice_id)) = 0 }//if isnull(ls_invoice_id) or len(trim(ls_invoice_id)) = 0
......
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