Commit e6474409 authored by ssalve's avatar ssalve

Sarita: Done changes to insert data into asset_transfer_hdr and...

Sarita: Done changes to insert data into asset_transfer_hdr and asset_transfer_det table on 31 JULY 18

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@188514 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 82851f48
...@@ -283,7 +283,10 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements ...@@ -283,7 +283,10 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements
if (("N".equalsIgnoreCase(getConfirmedG())) && ("R".equalsIgnoreCase(getXfrTypeG()))) if (("N".equalsIgnoreCase(getConfirmedG())) && ("R".equalsIgnoreCase(getXfrTypeG())))
{ {
System.out.println("GETcONFIRMEDg>>>>>"+getConfirmedG()); System.out.println("GETcONFIRMEDg>>>>>"+getConfirmedG());
errorCode = assetInstallPost(conn, tranid); //Commented and Added by sarita to add xtraParams in assetInstallPost method on 31 JULY 18 [START]
//errorCode = assetInstallPost(conn, tranid);
errorCode = assetInstallPost(conn, tranid,xtraParams);
//Commented and Added by sarita to add xtraParams in assetInstallPost method on 31 JULY 18 [END]
errorCode = errorCode == null ? "" : errorCode.trim(); errorCode = errorCode == null ? "" : errorCode.trim();
System.out.println("ErrorCode After assetRegisterPost@@3--->>[" System.out.println("ErrorCode After assetRegisterPost@@3--->>["
+ errorCode + "]"); + errorCode + "]");
...@@ -575,7 +578,10 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements ...@@ -575,7 +578,10 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements
rs = null; rs = null;
} }
errorCode = assetInstallPost(conn, tranid); //Commented and Added by sarita to add xtraParams in assetInstallPost method on 31 JULY 18 [START]
//errorCode = assetInstallPost(conn, tranid);
errorCode = assetInstallPost(conn, tranid,xtraParams);
//Commented and Added by sarita to add xtraParams in assetInstallPost method on 31 JULY 18 [END]
System.out System.out
.println("return string from assetRegisterPost 111----->>[" .println("return string from assetRegisterPost 111----->>["
+ errorCode + "]"); + errorCode + "]");
...@@ -645,13 +651,17 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements ...@@ -645,13 +651,17 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements
return "Success"; return "Success";
} }
private String assetInstallPost(Connection conn, String tranId) { //Commented and Added by sarita to add xtraParams in assetInstallPost method on 31 JULY 18 [START]
//private String assetInstallPost(Connection conn, String tranId) {
private String assetInstallPost(Connection conn, String tranId, String xtraParams) {
//Commented and Added by sarita to add xtraParams in assetInstallPost method on 31 JULY 18 [END]
System.out.println("-----assetRegisterPost method tranid :[" + tranId System.out.println("-----assetRegisterPost method tranid :[" + tranId
+ "]--------"); + "]--------");
ResultSet rs = null; ResultSet rs = null;
ResultSet rs2 = null; ResultSet rs2 = null;
ResultSet rs3 = null; ResultSet rs3 = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null; PreparedStatement pstmt2 = null;
PreparedStatement pstmt3 = null; PreparedStatement pstmt3 = null;
double exchRateL = 0.0D; double exchRateL = 0.0D;
...@@ -721,9 +731,9 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements ...@@ -721,9 +731,9 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements
String refSerL = ""; String refSerL = "";
String empCodeL = ""; String empCodeL = "";
String acctPrdProcL = ""; String acctPrdProcL = "";
String assetCodeParL = "",assetCodeFrom="",tranIdAssetinst="",assetClass="";; String assetCodeParL = "",assetCodeFrom="",tranIdAssetinst="",assetClass="",chgUser="";
Timestamp tranDate = null; Timestamp tranDate = null;
String lineNo ="",locCode ="",lotNo ="",lotSl =""; String lineNo ="",locCode ="",lotNo ="",lotSl ="",itemSerFromL="",grpCodeFromL = "";
int assinstDet = 0; int assinstDet = 0;
double quantity = 0,rate =0; double quantity = 0,rate =0;
String windowNamereval =""; String windowNamereval ="";
...@@ -746,14 +756,23 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements ...@@ -746,14 +756,23 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements
System.out.println("siteCodeFrom11 To--->>[" + getSiteCodeG() System.out.println("siteCodeFrom11 To--->>[" + getSiteCodeG()
+ "][" + getSiteCodeToG() + "]"); + "][" + getSiteCodeToG() + "]");
//Added by sarita to get chgUser on 31 JULY 18 [START]
chgUser = genericUtility.getValueFromXTRA_PARAMS(
xtraParams, "loginCode");
System.out.println("chgUser ["+chgUser+"]");
//Added by sarita to get chgUser on 31 JULY 18 [END]
if ("T".equalsIgnoreCase(getXfrTypeG())) { if ("T".equalsIgnoreCase(getXfrTypeG())) {
errorString = assetTransferPost(conn, tranId); errorString = assetTransferPost(conn, tranId);
System.out System.out
.println("return string from assetTransferPost 555 --->>[" .println("return string from assetTransferPost 555 --->>["
+ errorString + "]"); + errorString + "]");
if ((errorString != null) && (errorString.length() > 0)) { //Commented and added by sarita on 31 JULY 18 [START]
//if ((errorString != null) && (errorString.length() > 0)) {
if ((errorString != null) && (errorString.length() > 0) && !(errorString.indexOf("Success") > -1)) {
return errorString; return errorString;
} }
//Commented and added by sarita on 31 JULY 18 [END]
if (("P".equalsIgnoreCase(getLinkTypeG())) if (("P".equalsIgnoreCase(getLinkTypeG()))
|| ("A".equalsIgnoreCase(getLinkTypeG()))) { || ("A".equalsIgnoreCase(getLinkTypeG()))) {
...@@ -775,26 +794,219 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements ...@@ -775,26 +794,219 @@ public class FixedAssetTransfConf extends ActionHandlerEJB implements
return "Error"; return "Error";
} }
sql = "update asset_transfer_hdr set tran_id = ?, xfr_type = ? tran_id__iss = ? where tran_id = ?"; //Added and Commented by sarita to insert data into asset_transfer_hdr & asset_transfer_det table. on 31 JULY 18 [START]
sql = "insert into asset_transfer_hdr (tran_id,tran_date,xfr_type,site_code__from,site_code__to,confirmed,tran_id__iss,link_type,chg_date,chg_user,chg_term) values (?,?,?,?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, newTranid); pstmt.setString(1, newTranid);
pstmt.setString(2, "R"); pstmt.setTimestamp(2, getTranDateG());
pstmt.setString(3, tranId); pstmt.setString(3,"R");
pstmt.setString(4, tranId); pstmt.setString(4, getSiteCodeG());
int cnt = pstmt.executeUpdate(); pstmt.setString(5,getSiteCodeToG());
if (pstmt != null) { pstmt.setString(6,"N");
pstmt.setString(7,tranId);
pstmt.setString(8,getLinkTypeG());
pstmt.setDate(9,new java.sql.Date(System.currentTimeMillis()));
pstmt.setString(10, chgUser);
pstmt.setString(11, "system");
int assetTranHdr = pstmt.executeUpdate();
if (pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
System.out.println("Tran id 12346--->>[" + tranId + "]");
sql = "update asset_transfer_det set tran_id = ? where tran_id = ?"; sql = "select asset_code__to,item_ser__to,grp_code__to,asset_type,tran_id__create,tran_ser__create,bill_no,"
pstmt = conn.prepareStatement(sql); + "supp_code,supp_name,item_code,rcp_date,inst_date,curr_code,exch_rate,orginal_value,other_chgs,tax_amt,"
pstmt.setString(1, newTranid); + "tax_reco_amt,diff_amt__exch,excise_amt,comm_chgs,octroi_chgs,install_chgs,insur_chgs,total_value,"
cnt = pstmt.executeUpdate(); + "revalue_amt,"
if (pstmt != null) { + "revalue_date,use_date,"
pstmt.close(); + "depr_type__from,depr_perc_1,depr_method_1,depr_amt_1,wdv_amt_1,"
pstmt = null; + "depr_perc_2,depr_method_2,depr_amt_2,wdv_amt_2,asset_code__from,profit_loss,"
+ "total_value__bc,acct_prd__proc,verified_on,emp_code__verify,cctr_code__to,"
+ "wdv_amt_revl_2,depr_amt_revl_2,aloc_code__to,line_no,loc_code,lot_no,lot_sl,item_ser__from,grp_code__from from asset_transfer_det where tran_id = ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranId);
rs = pstmt1.executeQuery();
while (rs.next())
{
assetCodeToL = rs.getString("asset_code__to") == null ? ""
: rs.getString("asset_code__to").trim();
itemSerToL = rs.getString("item_ser__to") == null ? "" : rs
.getString("item_ser__to").trim();
grpCodeToL = rs.getString("grp_code__to") == null ? "" : rs
.getString("grp_code__to").trim();
assetTypeL = rs.getString("asset_type") == null ? "" : rs
.getString("asset_type").trim();
tranIdCreateL = rs.getString("tran_id__create") == null ? ""
: rs.getString("tran_id__create").trim();
tranSerCreateL = rs.getString("tran_ser__create") == null ? ""
: rs.getString("tran_ser__create").trim();
billNoL = rs.getString("bill_no") == null ? "" : rs
.getString("bill_no").trim();
suppCodeL = rs.getString("supp_code") == null ? "" : rs
.getString("supp_code").trim();
suppNameL = rs.getString("supp_name") == null ? "" : rs
.getString("supp_name").trim();
itemCodeL = rs.getString("item_code") == null ? "" : rs
.getString("item_code").trim();
rcpDateL = rs.getTimestamp("rcp_date");
instDateL = rs.getTimestamp("inst_date");
currCodeL = rs.getString("curr_code") == null ? "" : rs
.getString("curr_code").trim();
exchRateL = rs.getDouble("exch_rate");
orginalValueL = rs.getDouble("orginal_value");
otherChgsL = rs.getDouble("other_chgs");
taxAmtL = rs.getDouble("tax_amt");
taxRecoAmtL = rs.getDouble("tax_reco_amt");
diffAmtExchL = rs.getDouble("diff_amt__exch");
exciseAmtL = rs.getDouble("excise_amt");
commChgsL = rs.getDouble("comm_chgs");
octroiChgsL = rs.getDouble("octroi_chgs");
installChgsL = rs.getDouble("install_chgs");
insurChgsL = rs.getDouble("insur_chgs");
totalValueL = rs.getDouble("total_value");
revalueAmtL = rs.getDouble("revalue_amt");
revalueDateL = rs.getTimestamp("revalue_date");
useDateL = rs.getTimestamp("use_date");
deprTypefromL = rs.getString("depr_type__from") == null ? ""
: rs.getString("depr_type__from").trim();
deprPerc1L = rs.getDouble("depr_perc_1");
deprMethod1L = rs.getString("depr_method_1") == null ? ""
: rs.getString("depr_method_1").trim();
deprAmt1L = rs.getDouble("depr_amt_1");
wdvAmt1L = rs.getDouble("wdv_amt_1");
deprPerc2L = rs.getDouble("depr_perc_2");
deprMethod2L = rs.getString("depr_method_2") == null ? ""
: rs.getString("depr_method_2").trim();
deprAmt2L = rs.getDouble("depr_amt_2");
wdvAmt2L = rs.getDouble("wdv_amt_2");
System.out.println("wdvvvvvvvvv????"+wdvAmt2L);
assetCodefromL = rs.getString("asset_code__from") == null ? ""
: rs.getString("asset_code__from").trim();
profitLossL = rs.getDouble("profit_loss");
totalValueBcL = rs.getDouble("total_value__bc");
acctPrdProcL = rs.getString("acct_prd__proc") == null ? ""
: rs.getString("acct_prd__proc").trim();
verifiedOnL = rs.getTimestamp("verified_on");
empCodeVerifyL = rs.getString("emp_code__verify") == null ? ""
: rs.getString("emp_code__verify").trim();
cctrCodetoL = rs.getString("cctr_code__to") == null ? ""
: rs.getString("cctr_code__to").trim();
wdvAmtRevl2L = rs.getDouble("wdv_amt_revl_2");
deprAmtRevl2L = rs.getDouble("depr_amt_revl_2");
alocCodeToL = rs.getString("aloc_code__to") == null ? ""
: rs.getString("aloc_code__to").trim();
lineNo = rs.getString("line_no") == null ? "": rs.getString("line_no").trim();
locCode = rs.getString("loc_code") == null ? "": rs.getString("loc_code").trim();
lotNo = rs.getString("lot_no") == null ? "": rs.getString("lot_no").trim();
lotSl = rs.getString("lot_sl") == null ? "": rs.getString("lot_sl").trim();
itemSerFromL = rs.getString("item_ser__from") == null ? "": rs.getString("item_ser__from").trim();
grpCodeFromL = rs.getString("grp_code__from") == null ? "": rs.getString("grp_code__from").trim();
sql = "insert into asset_transfer_det (tran_id,asset_code__to,item_ser__to,grp_code__to,asset_type,tran_id__create,"
+ "tran_ser__create,bill_no,supp_code,supp_name,item_code,rcp_date,inst_date,curr_code,exch_rate,orginal_value,"
+ "other_chgs,tax_amt,tax_reco_amt,diff_amt__exch,excise_amt,comm_chgs,octroi_chgs,install_chgs,insur_chgs,"
+ "total_value,revalue_amt,revalue_date,use_date,depr_type__from,depr_perc_1,depr_method_1,depr_amt_1,wdv_amt_1,"
+ "depr_perc_2,depr_method_2,depr_amt_2,wdv_amt_2,asset_code__from,profit_loss,total_value__bc,acct_prd__proc,"
+ "verified_on,emp_code__verify,cctr_code__to,wdv_amt_revl_2,depr_amt_revl_2,aloc_code__to,line_no,loc_code,"
+ "lot_no,lot_sl,item_ser__from,grp_code__from) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
System.out.println("sql ["+sql+"]");
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, newTranid);
pstmt.setString(2, assetCodeToL);
pstmt.setString(3, itemSerToL);
pstmt.setString(4, grpCodeToL);
pstmt.setString(5, assetTypeL);
pstmt.setString(6, tranIdCreateL);
pstmt.setString(7, tranSerCreateL);
pstmt.setString(8, billNoL);
pstmt.setString(9, suppCodeL);
pstmt.setString(10, suppNameL);
pstmt.setString(11, itemCodeL);
pstmt.setTimestamp(12, rcpDateL);
pstmt.setTimestamp(13, instDateL);
pstmt.setString(14, currCodeL);
pstmt.setDouble(15, exchRateL);
pstmt.setDouble(16, orginalValueL);
pstmt.setDouble(17, otherChgsL);
pstmt.setDouble(18, taxAmtL);
pstmt.setDouble(19, taxRecoAmtL);
pstmt.setDouble(20, diffAmtExchL);
pstmt.setDouble(21, exciseAmtL);
pstmt.setDouble(22, commChgsL);
pstmt.setDouble(23, octroiChgsL);
pstmt.setDouble(24, installChgsL);
pstmt.setDouble(25, insurChgsL);
pstmt.setDouble(26, totalValueL);
pstmt.setDouble(27, revalueAmtL);
pstmt.setTimestamp(28, revalueDateL);
pstmt.setTimestamp(29, useDateL);
pstmt.setString(30, deprTypefromL);
pstmt.setDouble(31, deprPerc1L);
pstmt.setString(32, deprMethod1L);
pstmt.setDouble(33, deprAmt1L);
pstmt.setDouble(34, wdvAmt1L);
pstmt.setDouble(35, deprPerc2L);
pstmt.setString(36, deprMethod2L);
pstmt.setDouble(37, deprAmt2L);
pstmt.setDouble(38, wdvAmt2L);
pstmt.setString(39, assetCodefromL);
pstmt.setDouble(40, profitLossL);
pstmt.setDouble(41, totalValueBcL);
pstmt.setString(42, acctPrdProcL);
pstmt.setTimestamp(43, verifiedOnL);
pstmt.setString(44, empCodeVerifyL);
pstmt.setString(45, cctrCodetoL);
pstmt.setDouble(46, wdvAmtRevl2L);
pstmt.setDouble(47, deprAmtRevl2L);
pstmt.setString(48, alocCodeToL);
pstmt.setString(49, lineNo);
pstmt.setString(50, locCode);
pstmt.setString(51, lotNo);
pstmt.setString(52, lotSl);
pstmt.setString(53, itemSerFromL);
pstmt.setString(54, grpCodeFromL);
int assetTranDet = pstmt.executeUpdate();
System.out.println("Rows inserted in asset_transfer_det are ["+assetTranDet+"]");
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
/* sql = "update asset_transfer_hdr set tran_id = ?, xfr_type = ? tran_id__iss = ? where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, newTranid);
pstmt.setString(2, "R");
pstmt.setString(3, tranId);
pstmt.setString(4, tranId);
int cnt = pstmt.executeUpdate();
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("Tran id 12346--->>[" + tranId + "]");
sql = "update asset_transfer_det set tran_id = ? where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, newTranid);
cnt = pstmt.executeUpdate();
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
}
if (pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
} }
//Added and Commented by sarita to insert data into asset_transfer_hdr & asset_transfer_det table. on 31 JULY 18 [END]
} else if ("E".equalsIgnoreCase(getLinkTypeG())) { } else if ("E".equalsIgnoreCase(getLinkTypeG())) {
GenerateXmlFromDB generateXmlFromDB = GenerateXmlFromDB GenerateXmlFromDB generateXmlFromDB = GenerateXmlFromDB
......
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