Commit 7cdb2e71 authored by rtiwari's avatar rtiwari

*** empty log message ***


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100157 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 557bc430
......@@ -5,15 +5,18 @@ import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.fin.MiscDrCrRcpConf;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap;
......@@ -140,10 +143,10 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
rs = pstmt.executeQuery();
if (rs.next()) {
invoiceId = rs.getString(1);
custCode = rs.getString(2) == null ? "" : rs.getString(2);
siteCode = rs.getString(3) == null ? "" : rs.getString(3);
currCode = rs.getString(4) == null ? "" : rs.getString(4);
ExchRate = rs.getDouble(5);
custCode = rs.getString(2) == null ? "" : rs.getString(2);
siteCode = rs.getString(3) == null ? "" : rs.getString(3);
currCode = rs.getString(4) == null ? "" : rs.getString(4);
ExchRate = rs.getDouble(5);
}
if (rs != null) {
rs.close();
......@@ -193,6 +196,13 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
mapDebitNoteAmt.put(lineNo, detail3Amt);
// detail2xmlString=getDetailsXmlString(conn, xtraParams,
// invoiceId, aprvRate, debitNoteAmtDetail);
// make rounding off logic detail3Amt
System.out.println("detail3Amt Before rounding["+detail3Amt+"]");
detail3Amt = getRequiredDecimal(detail3Amt, custCode,conn);
System.out.println("detail3Amt After rounding["+detail3Amt+"]");
detail2xmlString = detail2xmlString
+ getDetailsXmlString(conn, invoiceId, lineNotrace,
lineNo, aprvRate, PODqty, lotNo, lotSl,
......@@ -201,13 +211,14 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
} // end while
System.out.println("detail2xmlString---->>[["
+ detail2xmlString + "]]");
System.out
.println("Final detail3AmtT in debit note---------->> : "
+ detail3AmtT);
System.out.println("Final detail3AmtT in debit note---Before rounding------->> : ["+ detail3AmtT+"]");
// Debit note amount cannot less than hundred.
// [31-JUL-2015] Sanket Girme
if (detail3AmtT >= 100) {
// make roundings off logic detail3AmtT
detail3AmtT = getRequiredDecimal(detail3AmtT, custCode,conn);
System.out.println("Final detail3AmtT in debit note---After rounding------->> : ["+ detail3AmtT+"]");
errString = genDebitNote("POD", invoiceId, custCode,
siteCode, xtraParams, currCode, ExchRate,
detail2xmlString, detail3AmtT, conn);
......@@ -226,24 +237,20 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
if ((errString != null)
&& errString.indexOf("CONFSUCCES") > -1) {
updCnt = updatePodHeader(conn, tranId, loginCode);
System.out
.println("return count from updateDebitNoteAmounts--->["
System.out.println("return count from updateDebitNoteAmounts--->["
+ updCnt + "]");
if (updCnt > 0) {
conn.commit();
errString = itmdbAccess.getErrorString("",
"VTCONSUCF", "", "", conn);
System.out
.println("------@@@Debit Note Generated successfully for amount : "
System.out.println("-----@@@Debit Note Generated successfully for amount : "
+ actualDBamount);
System.out
.println("Confirmation of Debit note done successfully----------");
System.out.println("Confirmation of Debit note done successfully----------");
} else {
errString = itmdbAccess.getErrorString("",
"VTNCONFT", "", "", conn);
conn.rollback();
System.out
.println("transaction not confirmed----------");
System.out.println("transaction not confirmed----------");
}
} else {
errString = itmdbAccess.getErrorString("",
......@@ -260,8 +267,7 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
} else {
errString = itmdbAccess.getErrorString("", "VTCOSUCFT", "",
"", conn);
System.out
.println("Debit note generated zero for invoice ID-->>["
System.out.println("Debit note generated zero for invoice ID-->>["
+ invoiceId + "]");
debitNoteTranID = "";
updCnt = updatePodHeader(conn, tranId, loginCode);
......@@ -988,8 +994,7 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
if (rs.next()) {
serviceURI = rs.getString("SERVICE_URI");
}
System.out.println("serviceURI = " + serviceURI + " compName = "
+ compName);
System.out.println("serviceURI = " + serviceURI + " compName = " + compName);
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
......@@ -1047,11 +1052,71 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements
System.out.println("Unable to rollback");
s.printStackTrace();
}
throw new ITMException(e);
}
}
return retString;
}
@SuppressWarnings("finally")
public double getRequiredDecimal(double actVal, String custCode,Connection conn) throws SQLException
{
ResultSet rs = null;
PreparedStatement pstmt = null;
String sql = "",round="";
double roundTo= 0d,reqVal=0d;
java.sql.Timestamp invDate = null;
DistCommon dist = new DistCommon();
try {
sql = " select round,round_to from customer where cust_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if (rs.next()) {
round = rs.getString("round")==null?"":rs.getString("round").trim();
roundTo = rs.getDouble("round_to");
}
reqVal = dist.getRndamt(actVal, round, roundTo);
// if("R".equals(round)) //Near
// {
//
// }
// else if("X".equals(round)) //Next
// {
// BigDecimal noZero = new BigDecimal(actVal);
// noZero.scale();
// noZero.precision();
// }
// else if("P".equals(round)) //Previous
// {
//
// }
// else if("N".equals(round)) //No Round
// {
// reqVal = actVal;
// }
} catch (Exception e) {
System.out.println("Exception in getRequiredDecimal off Round-------");
e.printStackTrace();
}
// NumberFormat numberFormat = NumberFormat.getIntegerInstance();
// Double DoubleValue = new Double(actVal);
// numberFormat.setMaximumFractionDigits(prec);
// String strValue = numberFormat.format(DoubleValue);
// strValue = strValue.replaceAll(",", "");
// double reqVal = Double.parseDouble(strValue);
finally
{
rs.close();
rs=null;
pstmt.close();
pstmt=null;
return reqVal;
}
}
}
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