Commit 162c4466 authored by pdas's avatar pdas

Fixed Asset Transfer changes made


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99523 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f9085391
......@@ -137,7 +137,8 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
errCode = "VTSITEFND"; //Site code does not exist in master
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
// sql ="select "
}
}
if(childNodeName.equalsIgnoreCase("link_type")){
......@@ -182,7 +183,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
errCode = "VTASSETCE"; //Old Asset Code can not be blank.
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
} else if ("T".equalsIgnoreCase(xFrType)){
} else if (!("T".equalsIgnoreCase(xFrType)) && !("R".equalsIgnoreCase(xFrType))){
count=getDBRowCount(conn,"asset_register","asset_code",assetCodeFrom);
System.out.println("asset_code count--->>["+count+"]");
if(count== 0){
......@@ -194,16 +195,16 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
SiteCode=getNameOrDescrForCode(conn,"asset_register","site_code","asset_code",assetCodeFrom);
System.out.println("Status---->>["+status+"]");
System.out.println("SiteCode---->>["+SiteCode+"]");
if(!(SiteCode.equalsIgnoreCase(siteCodeFrom))){
/*if(!(SiteCode.equalsIgnoreCase(siteCodeFrom))){
errCode = "VTASSTSITE";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if(!("A".equalsIgnoreCase(status))){
errCode = "TTTTTT"; //VTASETSTAT
}*/
if(!("A".equalsIgnoreCase(status))){
errCode = "VTASETSTAT"; //VTASETSTAT
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}else{
}/*else{
//Cannot transfer the asset if Asset Depreciation is not calculated
sql="select code from acctprd where ? between fr_date and to_date";
pstmt=conn.prepareStatement(sql);
......@@ -262,7 +263,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}*/
}
}
......@@ -274,11 +275,12 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
assetCodeTo=genericUtility.getColumnValue("asset_code__to", dom);
assetCodeTo=assetCodeTo== null ? "" :assetCodeTo.trim();
System.out.println("assetCodeFrom----->>["+assetCodeTo+"]");
if(assetCodeTo.length() == 0){
/* if(assetCodeTo.length() == 0){
errCode = "VTASETNND"; //
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}else{
}*/
if(assetCodeTo.length() > 0){
count=getDBRowCount(conn,"asset_register","asset_code",assetCodeTo);
System.out.println("asset_code count--->>["+count+"]");
if(count== 0){
......@@ -289,7 +291,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
status=getNameOrDescrForCode(conn,"asset_register","status","asset_code",assetCodeTo);
System.out.println("Status---->>["+status+"]");
if(!("A".equalsIgnoreCase(status))){
errCode = "BBBBBB";
errCode = "VTASETSTAT";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
......@@ -324,7 +326,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
System.out.println("grpCodeTo---->>["+grpCodeTo+"]");
if(grpCodeTo.length() > 0){
count=getDBRowCount(conn,"gencodes","fld_value",grpCodeTo);
System.out.println("itemser count---->>["+count+"]");
System.out.println("groupcode count---->>["+count+"]");
if(count==0){
errCode = "VTPGRPCD1"; //grp_code not present in master.
errList.add( errCode );
......@@ -389,7 +391,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
System.out.println("cctrCodeTo---->>["+cctrCodeTo+"]");
if(cctrCodeTo.length() > 0){
count=getDBRowCount(conn,"costctr","cctr_code",cctrCodeTo);
System.out.println("itemser count---->>["+count+"]");
System.out.println("cctrCodeTo count---->>["+count+"]");
if(count==0){
errCode = "VTCCTRCDPL"; //cctr code not present in master.
errList.add( errCode );
......@@ -420,6 +422,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
} //end switch
int errListSize = errList.size();
cnt =0;
String errFldName = null;
......@@ -754,7 +757,7 @@ public class FixedAssetTransf extends ValidatorEJB implements FixedAssetTransfLo
valueXmlString.append("<supp_code>").append("<![CDATA[" + suppCode + "]]>").append("</supp_code>");
if(suppName.length() == 0 && suppCode.length() > 0 ){
suppNameNew=getNameOrDescrForCode(conn,"supplier","descr","supp_code",suppCode);
suppNameNew=getNameOrDescrForCode(conn,"supplier","supp_name","supp_code",suppCode);
valueXmlString.append("<supp_name>").append("<![CDATA[" + suppNameNew + "]]>").append("</supp_name>");
}else{
valueXmlString.append("<supp_name>").append("<![CDATA[" + suppName + "]]>").append("</supp_name>");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.w3c.dom.Document;
@javax.ejb.Stateless
public class FixedAssetTransferPostSave extends ValidatorEJB implements FixedAssetTransferPostSaveLocal, FixedAssetTransferPostSaveRemote
{
FinCommon finCommon = new FinCommon();
DistCommon distCommon = new DistCommon();
public String postSave(String xmlString, String tranid, String editFlag,
String xtraParams, Connection conn) throws RemoteException,
ITMException
{
System.out.println("--------------PostSave called-------------");
System.out.println("tranid------------- " + tranid);
Document dom = null;
String errString = "";
try {
if (xmlString != null && xmlString.trim().length() > 0) {
dom = parseString(xmlString);
errString = postSave(dom, tranid, xtraParams, conn);
}
}
catch (Exception e)
{
System.out.println("Exception : FixedAssetTransferPostSave.java : postSave : ==>\n"+ e.getMessage());
throw new ITMException(e);
}
return errString;
}
public String postSave(Document dom, String tranid, String xtraParams,Connection conn)throws RemoteException,ITMException
{
System.out.println("In FixedAssetTransferPostSave ... ");
String errorString = "";
PreparedStatement pstmt = null;
//Document dom = null;
ResultSet rs =null;
boolean isError = false;
int count =0;
String tranIdRcp = "";
String tranId = "",lineNo="";
String errString ="";
String xmlString =null;
String sql = null;
double taxAmtHdr =0.0,taxAmtDet = 0.0,taxrecoAmtHdr=0.0,taxrecoAmtDet=0.0,totAmtHdr =0.0,totAmtDet =0.0;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
//dom = genericUtility.parseString(domString);
tranId = GenericUtility.getInstance().getColumnValue("tran_id",dom);
sql="select sum(case when tax_amt is null then 0 else tax_amt end),sum(total_value),sum(tax_reco_amt) from asset_transfer_det where tran_id = ? ";
{
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId );
rs = pstmt.executeQuery();
while (rs.next())
{
taxAmtDet = rs.getDouble(1);
taxrecoAmtDet = rs.getDouble(2);
totAmtDet = rs.getDouble(3);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
sql= "update asset_transfer_hdr set tax_amt = ? ,total_value = ?,tax_reco_amt = ? where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, taxAmtHdr);
pstmt.setDouble(2, totAmtHdr);
pstmt.setDouble(3,taxrecoAmtHdr);
pstmt.setString(4,tranId);
count = pstmt.executeUpdate();
System.out.println("post count---->>[" + count + "]");
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (count > 0)
{
conn.commit();
}
}
catch(Exception e)
{
System.out.println("Exception :FixedAssetTransferPostSaveEJB : :==>\n"+e.getMessage());
try
{
System.out.println("Before rollback");
conn.rollback();
}
catch(SQLException sqle)
{
System.out.println(sqle);
}
throw new ITMException(e);
}
return errorString;
}
}
\ No newline at end of file
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Local
public interface FixedAssetTransferPostSaveLocal extends ValidatorLocal
{
public String postSave(String xmlString,String tranid,String editFlag,String xtraParams,Connection conn) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Remote
public interface FixedAssetTransferPostSaveRemote extends ValidatorRemote
{
public String postSave(String xmlString,String tranid,String editFlag,String xtraParams,Connection conn) 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