Commit e80ef056 authored by pshinde's avatar pshinde

changes in Source code of Undo Receipt adjustment


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97944 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 236ff8c2
...@@ -31,7 +31,7 @@ import javax.ejb.Stateless; ...@@ -31,7 +31,7 @@ import javax.ejb.Stateless;
@Stateless @Stateless
public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecievableAdjConfLocal,UndoRecievableAdjConfRemote public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecievableAdjConfLocal,UndoRecievableAdjConfRemote
{ {
String status="";
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{ {
...@@ -47,10 +47,10 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie ...@@ -47,10 +47,10 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
//ConnDriver connDriver = new ConnDriver(); //ConnDriver connDriver = new ConnDriver();
String errString = null; String errString = null;
int cnt=0,updCnt=0,updCnt1=0,updCnt2=0,undoLineNo=1; int cnt=0,updCnt=0,updCnt1=0,updCnt2=0,undoLineNo=1,upCnt=0,upCount=0;
String refNo="",refSer="",refNoHeader="",tranType=""; String refNo="",refSer="",refNoHeader="",tranType="";
double adjAmt=0,totalAmt=0,sumAdjAmt=0; double adjAmt=0,totalAmt=0,sumAdjAmt=0,adjAmt1=0,totalAmt1=0,adjAmt2=0,totalAmt2=0;
String loginEmpCode=""; String loginEmpCode="",statusBef="";
Timestamp sysDate = null; Timestamp sysDate = null;
try try
{ {
...@@ -190,9 +190,77 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie ...@@ -190,9 +190,77 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
System.out.println("@@@updCnt========["+updCnt+"]"); System.out.println("@@@updCnt========["+updCnt+"]");
System.out.println("Status Checking*********");
sql1="select tot_amt,adj_amt,status from receivables where ref_no= ? and tran_ser=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, refNo);
pstmt1.setString(2, refSer);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
totalAmt1=Math.abs(rs1.getDouble("tot_amt"));
adjAmt1=Math.abs(rs1.getDouble("adj_amt"));
statusBef=rs1.getString("status");
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
System.out.println("totalAmt1============"+totalAmt1);
System.out.println("adjAmt1============"+adjAmt1);
System.out.println("statusBef============"+statusBef);
if(adjAmt1==0)
{
status="U";
System.out.println("adjAmt1==0*********");
/*//sql1=" update receivables set status ='U' where ref_no= ? and tran_ser=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, refNo);
pstmt1.setString(2, refSer);
updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1= null;*/
}
else if(adjAmt1==totalAmt1)
{
System.out.println("adjAmt1==totalAmt1*********");
status="A";
/*sql1=" update receivables set status ='A' where ref_no= ? and tran_ser=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, refNo);
pstmt1.setString(2, refSer);
updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1= null;*/
}
else if(adjAmt1!=0 && totalAmt1>adjAmt1)
{
System.out.println("totalAmt1>adjAmt1*********");
status="P";
/*sql1=" update receivables set status ='P' where ref_no= ? and tran_ser=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, refNo);
pstmt1.setString(2, refSer);
updCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1= null;*/
}
System.out.println("status=****-========="+status);
System.out.println("refNo=-========="+refNo);
System.out.println("refSer=-========="+refSer);
sql1=" update receivables set status = ? where ref_no= ? and tran_ser=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, status);
pstmt1.setString(2, refNo);
pstmt1.setString(3, refSer);
upCount = pstmt1.executeUpdate();
pstmt1.close();
pstmt1= null;
sql1="delete from receivables_adj where ref_no= ? and ref_ser_adj= ?"; sql1="delete from receivables_adj where ref_no= ? and ref_ser_adj= ?";
pstmt1 = conn.prepareStatement(sql1); pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, refNo); pstmt1.setString(1, refNo);
...@@ -284,41 +352,93 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie ...@@ -284,41 +352,93 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
System.out.println("@@@updCnt=== INVOICE ["+updCnt+"]"); System.out.println("@@@updCnt=== INVOICE ["+updCnt+"]");
} }
if (updCnt>0 && updCnt1>0 && updCnt2>0) System.out.println("refNoHeader@@@@@@@@============"+refNoHeader);
{ System.out.println("tranType@@@@@@@@@@@@============"+tranType);
sql1="select tot_amt,adj_amt,status from receivables where ref_no= ? and tran_ser=?";
pstmt= conn.prepareStatement(sql1);
pstmt.setString(1, refNoHeader);
pstmt.setString(2, tranType);
rs = pstmt.executeQuery();
if(rs.next())
{
totalAmt2=Math.abs(rs.getDouble("tot_amt"));
adjAmt2=Math.abs(rs.getDouble("adj_amt"));
statusBef=rs.getString("status");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("totalAmt1============"+totalAmt2);
System.out.println("adjAmt1============"+adjAmt2);
System.out.println("statusBef============"+statusBef);
if(adjAmt2==0)
{
status="U";
System.out.println("adjAmt2=0*********");
}
else if(adjAmt2==totalAmt2)
{
System.out.println("adjAmt2==totalAmt2********");
status="A";
}
else if(adjAmt2!=0 && totalAmt2>adjAmt2)
{
System.out.println("adjAmt2!=0 && totalAmt2>adjAmt2*********");
status="P";
}
System.out.println("status=****-========="+status);
System.out.println("refNoHeader=-========="+refNoHeader);
System.out.println("tranType=-========="+tranType);
sql1=" update receivables set status = ? where ref_no= ? and tran_ser=?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, status);
pstmt1.setString(2, refNoHeader);
pstmt1.setString(3, tranType);
upCnt = pstmt1.executeUpdate();
pstmt1.close();
pstmt1= null;
sql = " update undo_rec_adj set confirmed = 'Y',conf_date = ?, emp_code__aprv = ? where tran_id = ? "; if (updCnt>0 && updCnt1>0 && updCnt2>0)
pstmt = conn.prepareStatement(sql); {
pstmt.setTimestamp(1, sysDate);
pstmt.setString(2, loginEmpCode); sql = " update undo_rec_adj set confirmed = 'Y',conf_date = ?, emp_code__aprv = ? where tran_id = ? ";
pstmt.setString(3, tranId); pstmt = conn.prepareStatement(sql);
cnt = pstmt.executeUpdate(); pstmt.setTimestamp(1, sysDate);
pstmt.close(); pstmt.setString(2, loginEmpCode);
pstmt = null; pstmt.setString(3, tranId);
System.out.println(">>>>>>>>>>>>>>>>>cnt:"+cnt); cnt = pstmt.executeUpdate();
if (cnt>0) pstmt.close();
{ pstmt = null;
System.out.println(">>>>>>>>>>>>>>>>>cnt:"+cnt);
if (cnt>0)
{
errString = itmDBAccessLocal.getErrorString("","VTCNFSUCC",""); errString = itmDBAccessLocal.getErrorString("","VTCNFSUCC","");
}
else
{
errString = itmDBAccessLocal.getErrorString("","VTUNCNFIRM","");
}
} }
else else
{ {
System.out.println("not updated >>>>>>>>updCnt1>>>>>>>>>>>>:"+updCnt1);
errString = itmDBAccessLocal.getErrorString("","VTUNCNFIRM",""); errString = itmDBAccessLocal.getErrorString("","VTUNCNFIRM","");
} }
}
else
{
System.out.println("not updated >>>>>>>>updCnt1>>>>>>>>>>>>:"+updCnt1);
errString = itmDBAccessLocal.getErrorString("","VTUNCNFIRM","");
}
} }
} }
} }
} }
...@@ -349,7 +469,7 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie ...@@ -349,7 +469,7 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
System.out.println("--going to commit tranaction--"); System.out.println("--going to commit tranaction--");
if (errString.indexOf("VTCNFSUCC") > -1) if (errString.indexOf("VTCNFSUCC") > -1)
{ {
conn.commit(); conn.commit();
System.out.println("--transaction commited--"); System.out.println("--transaction commited--");
} }
...@@ -382,6 +502,8 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie ...@@ -382,6 +502,8 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
return errString ; return errString ;
} }
} }
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