Commit e311b159 authored by cpatil's avatar cpatil

modify for amount check condition


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93228 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 03c15445
......@@ -70,14 +70,14 @@ public class MiscVouchChkAmtEJB extends ActionHandlerEJB implements MiscVouchChk
public String confirm( Connection conn , String tranId ,String route_code ,String operation , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
PreparedStatement pStmt = null,pStmt1 = null;
ResultSet rs = null,rs1 = null;
String sql = "",sql1 = "";
String confirmed = "";
//String roleCode = "";
//java.sql.Date actionDateAprv1 = null;
int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0,amount=0.0;
String amountFlag = "false";
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="";
try
......@@ -136,54 +136,66 @@ public class MiscVouchChkAmtEJB extends ActionHandlerEJB implements MiscVouchChk
CONSUMED_AMT_ANAL
*/
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE from MISC_VOUCHDET WHERE tran_id = ? and line_no = ? ";
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE,amount from MISC_VOUCHDET WHERE tran_id = ? and line_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
pStmt.setString( 2, Integer.toString(i) );
rs = pStmt.executeQuery();
if (rs.next())
while (rs.next())
{
acctCode = rs.getString(1);
cctrCode = rs.getString(2);
analCode = rs.getString(3);
deptCode = rs.getString(4);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, siteCode );
pStmt.setString( 2, acctCode );
pStmt.setString( 3, cctrCode );
pStmt.setString( 4, analCode );
pStmt.setString( 5, deptCode );
pStmt.setString( 6, siteCode );
pStmt.setString( 7, acctCode );
pStmt.setString( 8, cctrCode );
pStmt.setString( 9, analCode );
pStmt.setString( 10, deptCode );
amount = rs.getDouble(5);
rs = pStmt.executeQuery();
if (rs.next())
{
budgetAmtAnal = rs.getDouble(1);
consumedAmtAnal = rs.getDouble(2);
// for amt chk
//CollableStatement cstmt = null;
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]");
if( budgetAmtAnal < consumedAmtAnal )
{
amountFlag = "true";
}
sql1 = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt1 = conn.prepareStatement(sql1);
pStmt1.setString( 1, siteCode );
pStmt1.setString( 2, acctCode );
pStmt1.setString( 3, cctrCode );
pStmt1.setString( 4, analCode );
pStmt1.setString( 5, deptCode );
pStmt1.setString( 6, siteCode );
pStmt1.setString( 7, acctCode );
pStmt1.setString( 8, cctrCode );
pStmt1.setString( 9, analCode );
pStmt1.setString( 10, deptCode );
rs1 = pStmt1.executeQuery();
if (rs1.next())
{
budgetAmtAnal = rs1.getDouble(1);
consumedAmtAnal = rs1.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]:::amount["+amount+"]");
if(( consumedAmtAnal-budgetAmtAnal ) < amount )
{
amountFlag = "true";
}
}
rs1.close();
rs1 = null;
pStmt1.close();
pStmt1 = null;
//
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
}
......
......@@ -70,14 +70,14 @@ public class PurVouchChkAmtEJB extends ActionHandlerEJB implements PurVouchChkAm
public String confirm( Connection conn , String tranId ,String route_code ,String operation , String prfmrCode , String rolecodeAprv , String xmlDataAll ,String prcID ) throws RemoteException, ITMException
{
PreparedStatement pStmt = null;
ResultSet rs = null;
String sql = "";
PreparedStatement pStmt = null,pStmt1 = null;
ResultSet rs = null,rs1 = null;
String sql = "",sql1 = "";
String confirmed = "";
//String roleCode = "";
//java.sql.Date actionDateAprv1 = null;
int cnt=0,i=0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0;
double budgetAmtAnal = 0.0,consumedAmtAnal=0.0,amount=0.0;
String amountFlag = "false";
String siteCode="",acctCode="",cctrCode="",analCode="",deptCode="";
try
......@@ -136,7 +136,7 @@ public class PurVouchChkAmtEJB extends ActionHandlerEJB implements PurVouchChkAm
CONSUMED_AMT_ANAL
*/
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE from vouchrcp WHERE tran_id = ? and line_no = ? ";
sql = "select ACCT_CODE,CCTR_CODE,anal_code,DEPT_CODE,vouch_amt from vouchrcp WHERE tran_id = ? and line_no = ? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, tranId );
pStmt.setString( 2, Integer.toString(i) );
......@@ -147,43 +147,60 @@ public class PurVouchChkAmtEJB extends ActionHandlerEJB implements PurVouchChkAm
cctrCode = rs.getString(2);
analCode = rs.getString(3);
deptCode = rs.getString(4);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
amount = rs.getDouble(5);
sql = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt = conn.prepareStatement(sql);
pStmt.setString( 1, siteCode );
pStmt.setString( 2, acctCode );
pStmt.setString( 3, cctrCode );
pStmt.setString( 4, analCode );
pStmt.setString( 5, deptCode );
pStmt.setString( 6, siteCode );
pStmt.setString( 7, acctCode );
pStmt.setString( 8, cctrCode );
pStmt.setString( 9, analCode );
pStmt.setString( 10, deptCode );
rs = pStmt.executeQuery();
if (rs.next())
{
budgetAmtAnal = rs.getDouble(1);
consumedAmtAnal = rs.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]");
if( budgetAmtAnal < consumedAmtAnal )
{
amountFlag = "true";
}
// for chk amt
sql1 = " select FN_GET_BUDGET_AMT('VOUCH',?,?,?,?,?,'A') BUDGET_AMT_ANAL , " +
" FN_GET_CONS_AMT('VOUCH',?,?,?,?,?,'A') CONSUMED_AMT_ANAL from dual";
pStmt1 = conn.prepareStatement(sql1);
pStmt1.setString( 1, siteCode );
pStmt1.setString( 2, acctCode );
pStmt1.setString( 3, cctrCode );
pStmt1.setString( 4, analCode );
pStmt1.setString( 5, deptCode );
pStmt1.setString( 6, siteCode );
pStmt1.setString( 7, acctCode );
pStmt1.setString( 8, cctrCode );
pStmt1.setString( 9, analCode );
pStmt1.setString( 10, deptCode );
rs1 = pStmt1.executeQuery();
if (rs1.next())
{
budgetAmtAnal = rs1.getDouble(1);
consumedAmtAnal = rs1.getDouble(2);
System.out.println("i:["+i+"]:::budgetAmtAnal::["+budgetAmtAnal+"]:::::consumedAmtAnal::["+consumedAmtAnal+"]:::vouch_amt["+amount+"]");
if ( ( consumedAmtAnal - budgetAmtAnal ) < amount )
{
amountFlag = "true";
}
}
rs1.close();
rs1 = null;
pStmt1.close();
pStmt1 = null;
//
}
rs.close();
rs = null;
pStmt.close();
pStmt = 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