Commit d712c2b0 authored by msalla's avatar msalla

At gimatex, user is using voucher generation process. Purchase voucher is...

At gimatex, user is using voucher generation process. Purchase voucher is getting generated from process but advance account code is not set purchase voucher as defined in suplier master

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203808 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 50ab6933
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ProcessLocal;
import ibase.webitm.utility.ITMException;
public interface VoucherGenLocal extends ProcessLocal //,EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.fin.CreatePoRcpVoucher;
import ibase.webitm.utility.ITMException;
public class VoucherGenPrc extends ProcessEJB implements VoucherGenRemote,VoucherGenLocal
{
Connection conn = null;
String errorString = null;
NodeList parentNodeList = null;
NodeList enqNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node enqNode = null;
Node childNode = null;
int ctr = 0,cnt = 0;
String childNodeName = null;
String errCode = "";
int currentFormNo=0;
int childNodeListLength;
String selectQry = "";
String selectItem = "";
ResultSet rs = null;
PreparedStatement psmt = null;
Statement stmt = null;
Statement dtl2Stmt = null;
ConnDriver connDriver = null;
ResultSet dtlRs = null;
String working = "";
StringBuffer xmlString = null;
int date = 0,month= 0,year= 0,hour = 0,min = 0,sec = 0;
Date d = null;
//BasePreparedStatement oraPsmt = null;
Statement st = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
int upd = 0;
String returnString = "";
E12GenericUtility genericUtility= new E12GenericUtility();
//GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String process() throws RemoteException,ITMException
{
return "";
}
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException
{
System.out.println("******* Inside RecPayXfrPrc process **********");
System.out.println(".....xtraParams["+xtraParams+"]");
Document detailDom = null;
Document headerDom = null;
String retStr = "";
try
{
if(xmlString != null && xmlString.trim().length()!=0)
{
headerDom = genericUtility.parseString(xmlString);
}
if(xmlString2 != null && xmlString2.trim().length()!=0)
{
detailDom = genericUtility.parseString(xmlString2);
}
retStr = process(headerDom, detailDom, windowName, xtraParams);
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception : RecPayXfrPrc: process(String xmlString, String xmlString2, String windowName, String xtraParams): "+e.getMessage());
throw new ITMException(e);
}
return retStr;
}//END OF PROCESS (1)
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{
String retStr = "";
PreparedStatement pstmt = null;
PreparedStatement UpdatePstmt = null;
PreparedStatement UpdateDtPstmt = null;
PreparedStatement AprvPstmt = null;
ResultSet rs = null;
String sql = "" ,sql1 = "",errString = "";
String retString = "" ,errCode = "",tranId="";
String loginSiteCode="",empCode="",chgUser="",chgTerm="",loginCode="",termid = "";
String policyNo="",insCertNo="",agent_code="",invoiceId="";
int count =0,cnt =0;
String curr_code="",dayNo = "",shiftOfDay = "";
double exch_rate=0,netAmt=0;
Timestamp tranDate =null;
String siteCode = "",wokCntr = "",datefrom = "",dateto = "",holTblno = "",insertQry = "";
String userId = "";
String suppCode = "",enqNo = "",itemCode = "",status = "",errorString = "";
String [] itemCodeAr = null;
String lineNo="";
int parentNodeListLength = 0;
int childNodeListLength = 0;
int no = 0,voucherid;
int cntstatusUn = 0;
int noOfrowSel = 0;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
// added valriable
String ls_adv_lic = "";
String merrcode = "";
String qcTableNo = "";
String tableDescr = "" ;
Timestamp exprDate = null;
Timestamp chgDate = null;
String specCode = "";
String expctedRes = "";
String sqlSpec = "";
String descr = "";
String benefitType = "";
String str = "";
String despCurrCode = "";
String keyString = "";
String alType = "";
String ls_advlic_line_no = "";
String ls_pocldet_line_no = "";
String currCode = "";
String exchRate = "";
double exchRateDec = 0.0;
String value ="";
double valueDec =0.00;
String qtyImp = "";
double qtyImpDec = 0.00;
String amtImp = "";
double amtImpDec = 0.00;
String qty = "";
double qtyDec =0.00;
String amt = "";
double amtDec=0.0;
ArrayList voucherList=new ArrayList<String>();
double baseValue = 0.00;
String fileNo = "";
String advCurrCode = "",voucherId="";
String despId = "",errorCode="";
double returnExchRateDec = 0.00;
String sqlInsert="",exchangeRate="",exchangeRateStr="";
Timestamp currDate = null;
boolean resultFlag = false,connStatus = false;
int successVouccnt = 0,failVouccnt=0;
String currAppdate = null,quotNo = "",quotNoDup = "",tranIdFrom="",tranIdTo="";
currDate = new java.sql.Timestamp(System.currentTimeMillis()) ;
try
{
System.out.println("voucher process");
if (conn == null)
{
conn = getConnection();
conn.setAutoCommit(false);
connStatus = true;
}
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId");
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
currAppdate = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(currDate).toString();
currAppdate = genericUtility.getValidDateString(currAppdate,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat());
currDate = Timestamp.valueOf(currAppdate + " 00:00:00.00");
siteCode = genericUtility.getColumnValue("site_code",headerDom);
tranIdFrom = genericUtility.getColumnValue("tran_id__from",headerDom);
tranIdTo= genericUtility.getColumnValue("tran_id__to",headerDom);
CreatePoRcpVoucher createVouc = new CreatePoRcpVoucher();
sql="select tran_id from porcp where tran_id >=? and tran_id <=? and site_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdFrom);
pstmt.setString(2,tranIdTo);
pstmt.setString(3,siteCode);
rs = pstmt.executeQuery();
while(rs.next())
{
tranId=rs.getString(1);
voucherList.add(tranId);
}
System.out.println("voucher process");
pstmt.close();
pstmt=null;
rs.close();
rs=null;
for(int i = 0; i < voucherList.size(); i++)
{
voucherId=(String) voucherList.get(i);
retString = createVouc.poRcpVouchRetrieve(voucherId, xtraParams, conn);
if(retString.indexOf("Success") != -1)
{
successVouccnt++;
conn.commit();
}
else
{
failVouccnt++;
conn.rollback();
}
}
if(successVouccnt>0 && failVouccnt==0)
{
errorCode="VTVOUGEN";
retString = getMsg("Voucher successfully generated against "+successVouccnt+" purchase receipts selected in the range",errorCode, conn);
}
else if(successVouccnt>0 && failVouccnt>0)
{
errorCode="VTVOUPAR";
retString = getMsg("Voucher successfully generated against "+successVouccnt+" purchase receipts and voucher generation failed for "+failVouccnt + " purchase receipts" ,errorCode,conn);
}
else
{
errorCode="VTVOUNOT";
retString = getMsg("Voucher generation failed against "+failVouccnt+" purchase receipts selected in the range",errorCode,conn);
}
}
catch(Exception exception)
{
exception.printStackTrace();
System.out.println(exception.getMessage());
throw new ITMException(exception);
}
finally
{
try
{
if (rs != null)
{
rs.close(); rs = null;
}
if (pstmt != null)
{
pstmt.close(); pstmt = null;
}
if(conn != null && !conn.isClosed() && connStatus)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
return retString;
}
private String getMsg(String trace,String Code,Connection conn) throws ITMException, Exception
{
String mainStr ="";
try
{
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String errString = "";
errString = itmDBAccessEJB.getErrorString("",Code,"","",conn);
String begPart = errString.substring(0,errString.indexOf("<message>")+9);
String begDesc = errString.substring(0,errString.indexOf("<description>")+13);
// String endDesc = errString.substring(errString.indexOf("</description>"));
String endDesc = errString.substring(errString.indexOf("<description>"),errString.length());
//mainStr= begPart + trace + " </message><description>";
mainStr= begPart + trace + " </message>";
mainStr= mainStr+endDesc;
System.out.println("Main STring value ["+mainStr+"]");
// mainStr= begPart + trace + " </message>";
begPart = null;
itmDBAccessEJB = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return mainStr;
}
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ProcessRemote;
import ibase.webitm.utility.ITMException;
public interface VoucherGenRemote extends ProcessRemote //,EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException;
}
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