Commit 7140d73f authored by cpatil's avatar cpatil

modify for last line not deleted


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101629 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 12cfbc96
...@@ -49,21 +49,21 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal, ...@@ -49,21 +49,21 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal,
String errString =""; String errString ="";
String xmlString =null; String xmlString =null;
String sql = null; String sql = null;
String siteCode = ""; String siteCode = "";
String refSer = "",refNo = ""; String refSer = "",refNo = "";
double rcpAmt = 0, detAmt =0, rcpAmtVal = 0 ; double rcpAmt = 0, detAmt =0, rcpAmtVal = 0 ;
int cnt=0; int cnt=0;
try try
{ {
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
// GenericUtility genericUtility = GenericUtility.getInstance(); // GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
dom = genericUtility.parseString(domString); dom = genericUtility.parseString(domString);
tranId = genericUtility.getColumnValue("tran_id",dom); tranId = genericUtility.getColumnValue("tran_id",dom);
System.out.println("Tran ID for Domestic Receipt Transaction:::::"+tranId); System.out.println("Tran ID for Domestic Receipt Transaction:::::"+tranId);
sql="select b.ref_no,b.ref_ser,b.rcp_amt,a.site_code from receipt_form a,rcpdet_form b where a.tran_id = b.tran_id and a.tran_id = ?" ; sql="select b.ref_no,b.ref_ser,b.rcp_amt,a.site_code from receipt_form a,rcpdet_form b where a.tran_id = b.tran_id and a.tran_id = ?" ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId ); pstmt.setString(1,tranId );
...@@ -74,7 +74,7 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal, ...@@ -74,7 +74,7 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal,
refNo = rs.getString("ref_no"); refNo = rs.getString("ref_no");
rcpAmt = rs.getDouble("rcp_amt"); rcpAmt = rs.getDouble("rcp_amt");
siteCode = rs.getString("site_code"); siteCode = rs.getString("site_code");
sql = "SELECT (TOT_AMT - ADJ_AMT) AS AMT FROM RECEIVABLES WHERE REF_NO = ? and tran_ser = ? and site_code=? " ; sql = "SELECT (TOT_AMT - ADJ_AMT) AS AMT FROM RECEIVABLES WHERE REF_NO = ? and tran_ser = ? and site_code=? " ;
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
...@@ -91,7 +91,7 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal, ...@@ -91,7 +91,7 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("rcpAmtVal :"+rcpAmtVal); System.out.println("rcpAmtVal :"+rcpAmtVal);
sql = "select sum(rcp_amt) from rcpdet_form where ref_no = ? and ref_ser = ? and tran_id in(select tran_id from receipt_form where confirmed='N') " ; sql = "select sum(rcp_amt) from rcpdet_form where ref_no = ? and ref_ser = ? and tran_id in(select tran_id from receipt_form where confirmed='N') " ;
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
...@@ -107,42 +107,88 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal, ...@@ -107,42 +107,88 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal,
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("detAmt :"+detAmt); System.out.println("detAmt :"+detAmt);
if(detAmt > rcpAmtVal) if(detAmt > rcpAmtVal)
{ {
conn.rollback(); conn.rollback();
errString = itmDBAccessEJB.getErrorString("","VTAMTEXEED","","",conn); errString = itmDBAccessEJB.getErrorString("","VTAMTEXEED","","",conn);
System.out.println("Error String:::::::::"+errString); System.out.println("Error String:::::::::"+errString);
String begPart = errString.substring( 0, errString.indexOf("</description>") ); String begPart = errString.substring( 0, errString.indexOf("</description>") );
String mainStr=""; String mainStr="";
System.out.println("Reference no::::::::::"+refNo); System.out.println("Reference no::::::::::"+refNo);
String endPart=errString.substring( errString.indexOf("</description>"), errString.length() ); String endPart=errString.substring( errString.indexOf("</description>"), errString.length() );
mainStr=" for Ref Ser : "+refSer+"And Ref No : "+refNo; mainStr=" for Ref Ser : "+refSer+"And Ref No : "+refNo;
errString = begPart+mainStr + endPart; errString = begPart+mainStr + endPart;
return errString ;//amount exceeds than total amount in receivables return errString ;//amount exceeds than total amount in receivables
} }
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
// cpatil test
int cnt8 =0;
sql = "select count(1) from rcpdet_form WHERE tran_id= ? and ( ref_ser is not null or ref_no is not null or rcp_amt > 0 ) " ;
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,tranId);
rs1 = pstmt1.executeQuery();
if( rs1.next())
{
cnt8=rs1.getInt(1);
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("@@@@@@ cnt8["+cnt8+"]");
//sql = "DELETE FROM rcpdet_form WHERE tran_id= ? and ref_ser is null and ref_no is null and rcp_amt = 0 ";
int cnt9=0;
if( cnt8 == 0)
{
sql = " DELETE FROM rcpdet_form " +
" WHERE tran_id= ? and ref_ser is null and ref_no is null and rcp_amt = 0 " +
" and line_no > ( select min(line_no) from rcpdet_form " +
" WHERE tran_id= ? and ref_ser is null and ref_no is null and rcp_amt = 0 ) ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,tranId);
pstmt1.setString(2,tranId);
cnt9 = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
}
else
{
sql = " DELETE FROM rcpdet_form " +
" WHERE tran_id= ? " +
" and ref_ser is null and ref_no is null " ;
//"and rcp_amt = 0 ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,tranId);
cnt9 = pstmt1.executeUpdate();
pstmt1.close();
pstmt1 = null;
}
System.out.println("@@@@@@ cnt9["+cnt9+"]");
// end
} }
catch(Exception e) catch(Exception e)
{ {
isError = true; isError = true;
System.out.println("Exception :Domestic Receipt : :==>\n"+e.getMessage()); System.out.println("Exception :Domestic Receipt : :==>\n"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
...@@ -188,8 +234,8 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal, ...@@ -188,8 +234,8 @@ public class GenRcpPostSave extends ValidatorEJB implements GenRcpPostSaveLocal,
} }
} }
System.out.println("Out Domestic Receipt save logic ... "); System.out.println("Out Domestic Receipt save logic ... ");
return errString; return errString;
} }
} }
\ No newline at end of file
...@@ -840,12 +840,12 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -840,12 +840,12 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
if (isDulplicateFrmDom()) /*if (isDulplicateFrmDom())
{ {
errCode = "VTDUPREFNO"; errCode = "VTDUPREFNO";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }*/
/**************************/ /**************************/
/* if(isAmountExceed(domAll,dom1,conn)) /* if(isAmountExceed(domAll,dom1,conn))
...@@ -1208,14 +1208,15 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen ...@@ -1208,14 +1208,15 @@ public class GenReceiptIC extends ValidatorEJB implements GenReceiptICLocal, Gen
} }
//added checkAmtvalidation by mahendra on dated 03-09-2015 //added checkAmtvalidation by mahendra on dated 03-09-2015
if(checkAmtvalidation(dom2)) /* // commented and added validation in java script by cpatil on 13/05/16
if(checkAmtvalidation(dom2))
{ {
errCode = "VTCHQATINV"; errCode = "VTCHQATINV";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
*/
} }
......
...@@ -811,7 +811,8 @@ ...@@ -811,7 +811,8 @@
<xsl:for-each select="//Detail2"> <xsl:for-each select="//Detail2">
<xsl:variable name="domIDDetail"> <xsl:variable name="domIDDetail">
<xsl:value-of select="@domID" /> <xsl:value-of select="line_no" />
<!-- <xsl:value-of select="@domID" /> -->
</xsl:variable> </xsl:variable>
<xsl:variable name="updateFlagDetail"> <xsl:variable name="updateFlagDetail">
<xsl:value-of select="attribute/@updateFlag" /> <xsl:value-of select="attribute/@updateFlag" />
...@@ -820,7 +821,8 @@ ...@@ -820,7 +821,8 @@
<xsl:value-of select="attribute/@status" /> <xsl:value-of select="attribute/@status" />
</xsl:variable> </xsl:variable>
<xsl:variable name="dbIDDetail"> <xsl:variable name="dbIDDetail">
<xsl:value-of select="@dbID" /> <xsl:value-of select="line_no" />
<!-- <xsl:value-of select="@dbID" /> -->
</xsl:variable> </xsl:variable>
<xsl:variable name="pkNamesDetail"> <xsl:variable name="pkNamesDetail">
<xsl:value-of select="attribute/@pkNames" /> <xsl:value-of select="attribute/@pkNames" />
......
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