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;
@Stateless
public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecievableAdjConfLocal,UndoRecievableAdjConfRemote
{
String status="";
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
......@@ -47,10 +47,10 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
//ConnDriver connDriver = new ConnDriver();
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="";
double adjAmt=0,totalAmt=0,sumAdjAmt=0;
String loginEmpCode="";
double adjAmt=0,totalAmt=0,sumAdjAmt=0,adjAmt1=0,totalAmt1=0,adjAmt2=0,totalAmt2=0;
String loginEmpCode="",statusBef="";
Timestamp sysDate = null;
try
{
......@@ -192,6 +192,74 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
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= ?";
pstmt1 = conn.prepareStatement(sql1);
......@@ -284,6 +352,58 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
System.out.println("@@@updCnt=== INVOICE ["+updCnt+"]");
}
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;
if (updCnt>0 && updCnt1>0 && updCnt2>0)
{
......@@ -384,4 +504,6 @@ public class UndoRecievableAdjConf extends ActionHandlerEJB implements UndoRecie
}
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