Commit fb84ed46 authored by vvengurlekar's avatar vvengurlekar

MiscPayablesHld.java

MiscPayablesHldLocal.java
MiscPayablesHldRemote.java - created new component against obj_name misc_payable_hold 


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@181869 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6643fd58
/*
Window Name : w_misc_voucher
Button Name : Hold
Action : Put Voucher on hold i.e it will update MISC_PAYABLES Table.
*/
package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.util.Calendar;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.system.config.*;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import javax.ejb.Stateless; // added for ejb3
import javax.naming.InitialContext;
import org.w3c.dom.Document;
@Stateless // added for ejb3
public class MiscPayablesHld extends ActionHandlerEJB implements MiscVoucherHldLocal,MiscVoucherHldRemote //SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException
{
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String actionHandler() throws RemoteException,ITMException
{
return "";
}
public String actionHandler(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("MiscPayablesHld:actionHandler called");
String retString = null;
try
{
System.out.println("Transaction ID To Hold :: "+tranID);
retString = actionHold(tranID,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception :MiscPayablesHld :actionHandler:" + e.getMessage() + ":");
throw new ITMException(e);
}
System.out.println("returning from MiscPayablesHld actionHandler"+retString);
return retString;
}
private String actionHold(String tranID, String xtraParams)throws ITMException
{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String errCode="";
String errString="";
String sql = "";
String updSql = "";
int rows=0;
float totAmt=0;
float adjAmt=0;
float holdAmt=0;
float balAmt=0;
try
{
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
sql="SELECT TOT_AMT,ADJ_AMT,CASE WHEN HOLD_AMT IS NULL THEN 0 ELSE HOLD_AMT END HOLD_AMT FROM MISC_PAYABLES WHERE TRAN_ID = '"+tranID+"'";
rs = stmt.executeQuery(sql);
if(rs.next())
{
totAmt=rs.getFloat("TOT_AMT");
adjAmt=rs.getFloat("ADJ_AMT");
holdAmt=rs.getFloat("HOLD_AMT");
}
balAmt = totAmt-adjAmt;
if(balAmt == 0)
{
errCode = "VTBAL2"; // already paid off
}
//else if(adjAmt != 0 && adjAmt != totAmt)
//{
// errCode = "VTBAL2"; // partly paid off
//}
else if (holdAmt == 0)
{
//Put Voucher on hold
//updSql = "UPDATE MISC_PAYABLES SET HOLD_AMT = TOT_AMT WHERE TRAN_SER = 'M-VOUC' AND REF_NO = '"+tranID+"'";
updSql = "UPDATE MISC_PAYABLES SET HOLD_AMT = TOT_AMT - ADJ_AMT WHERE TRAN_ID = '"+tranID+"'";
System.out.println("Updating SQL :: "+updSql);
rows=stmt.executeUpdate(updSql);
}
else
{
errCode="VTHOLD3";
}
if(errCode.trim().length() == 0 && rows > 0)
{
errCode = "VTHOLD2";
conn.commit();
System.out.println("\n <==== Transaction Updated Successfully ====>");
}
if (errCode != null && errCode.trim().length() > 0)
{
System.out.println("MiscPayablesHld:errCode:"+errCode);
//errString = itmDBAccessEJB.getErrorString("", errCode, "", "", conn);//Gulzar 30-12-06
errString = itmDBAccessEJB.getErrorString("", errCode, "");//Gulzar 30-12-06
}
}
catch(Exception e)
{
System.out.println("Exception :MiscPayablesHld :" + e.getMessage() + ":");
throw new ITMException(e);
}
finally
{
try
{
System.out.println("Connection Closing......");
conn.close();
conn = null;
}
catch(Exception e){}
}
return errString;
}
}
\ No newline at end of file
package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface MiscPayablesHldLocal extends ActionHandlerLocal//,EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String tranID, String xtraParams,String forcedFlag) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface MiscPayablesHldRemote extends ActionHandlerRemote//,EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String tranID, String xtraParams,String forcedFlag) throws RemoteException,ITMException;
}
\ No newline at end of file
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