Commit 7b294088 authored by dpawar's avatar dpawar

update regulated price validation (disparm)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93462 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6576cf9b
......@@ -23,6 +23,7 @@ import javax.naming.InitialContext;
public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeliveryConfLocal,ProofOfDeliveryConfRemote
{
String debitNoteTranID="";
boolean isRegPriceNotFound=false;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("--------------confirm method of ProofOfDeliveryConf ------------- : ");
......@@ -100,7 +101,6 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
{
String invoiceId="",custCode="",siteCode="",currCode="",loginCode="";
double ExchRate=0.0,actualDBamount=0.0;
boolean isRegPrice=false;
GenericUtility genericUtility=new GenericUtility();
loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("Login Code ------->> "+loginCode);
......@@ -111,7 +111,7 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setDate(2, new java.sql.Date(System.currentTimeMillis()));
pstmt.setString(3,loginCode); //loginCode
pstmt.setString(3,loginCode); //loginCode //"E10808"
pstmt.setString(4, tranId);
updCnt=pstmt.executeUpdate();
......@@ -171,11 +171,24 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
}
else
{
System.out.println("isRegPriceNotFound----->> : ["+!(isRegPriceNotFound)+"]");
if (!(isRegPriceNotFound))
{
System.out.println("-----calculation of debit note condition--------");
debitNoteAmtAct=debitNoteCalculation(conn,regulatedPrice,invRate,invQty,PODrate,PODqty,itemCode);
actualDBamount=actualDBamount + debitNoteAmtAct;
detail2xmlString=detail2xmlString + getDetail2xmlString(debitNoteAmtAct,itemCode,PODrate,PODqty,lotNo,lotSl,lineNo,conn);
System.out.println("itemCode : "+itemCode+" Line no -->"+lineNo+" --debitNoteAmtAct ------->>"+debitNoteAmtAct);
}
else
{
errString = itmdbAccess.getErrorString("", "VTDISRPND", "", "", conn);
System.out.println("---------Error : Regulated price not found (Transaction Rollback)----------");
conn.rollback();
return errString;
}
}
} //end while
System.out.println("Final actualDBamount---------->> : "+actualDBamount);
......@@ -523,10 +536,10 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
}
catch(Exception e)
{
System.out.println("Exception in findValue ");
System.out.println("Exception in getColumnDescr ");
e.printStackTrace();
}
System.out.println("returning String from findValue " + findValue);
System.out.println("returning String from getColumnDescr " + findValue);
return findValue;
}
......@@ -542,11 +555,21 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
if(regulaPrice.equalsIgnoreCase("Y"))
{
System.out.println("Regulated price-------->> "+regulaPrice);
double allowPercentageD=0.0,invoiceAmt=0.0,stockistAmt=0.0,actualAllowAmt=0.0,percentageAmtInv=0.0;
//double allowPercentageD=0.0,invoiceAmt=0.0,stockistAmt=0.0,actualAllowAmt=0.0,percentageAmtInv=0.0;
String varName="AML_REG_PER",allowPercentage="";
allowPercentage=getColumnDescr(conn,"100-var_value","disparm","var_name",varName);
int cnt= getDBRowCount(conn,"disparm","var_name",varName);
System.out.println("Regulated price var name count --->>["+cnt+"] for item code : "+itemCode);
if(cnt > 0)
allowPercentage=getColumnDescr(conn,"100-var_value","disparm","var_name",varName);
else
{
System.out.println("----Count condition is false--------- :"+debitNoteAmount);
isRegPriceNotFound=true;
return debitNoteAmount;
//isRegPrice=true;
}
debitNoteAmount=getDebitNoteAmount(allowPercentage,rateInvoice,qtyInvoice,podRate,podQty);
System.out.println("Item code wise debit note :[ItemCode] :["+itemCode+"] :"+debitNoteAmount);
......@@ -556,10 +579,19 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
else if(regulaPrice.equalsIgnoreCase("N"))
{
System.out.println("Regulated price-------->> "+regulaPrice);
double allowPercentageD=0.0,invoiceAmt=0.0,stockistAmt=0.0,actualAllowAmt=0.0,percentageAmtInv=0.0;
//double allowPercentageD=0.0,invoiceAmt=0.0,stockistAmt=0.0,actualAllowAmt=0.0,percentageAmtInv=0.0;
String varName="AML_NONREG_PER",allowPercentage="";
int cnt= getDBRowCount(conn,"disparm","var_name",varName);
System.out.println("Regulated price var name count --->>["+cnt+"] for item code : "+itemCode);
if(cnt > 0)
allowPercentage=getColumnDescr(conn,"100-var_value","disparm","var_name",varName);
else
{
System.out.println("----Count condition is false--------- :"+debitNoteAmount);
isRegPriceNotFound=true;
return debitNoteAmount;
//isRegPrice=true;
}
debitNoteAmount=getDebitNoteAmount(allowPercentage,rateInvoice,qtyInvoice,podRate,podQty);
System.out.println("Item code wise debit note :[ItemCode] :["+itemCode+"] :"+debitNoteAmount);
......@@ -572,8 +604,18 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
System.out.println("Regulated price-------->> "+regulaPrice);
//double allowPercentageD=0.0,invoiceAmt=0.0,stockistAmt=0.0,actualAllowAmt=0.0,percentageAmtInv=0.0;
String varName="AML_DPCO_PER",allowPercentage="";
allowPercentage=getColumnDescr(conn,"100-var_value","disparm","var_name",varName);
int cnt= getDBRowCount(conn,"disparm","var_name",varName);
System.out.println("Regulated price var name count --->>["+cnt+"] for item code : "+itemCode);
if(cnt > 0)
allowPercentage=getColumnDescr(conn,"100-var_value","disparm","var_name",varName);
else
{
System.out.println("----Count condition is false--------- :"+debitNoteAmount);
isRegPriceNotFound=true;
return debitNoteAmount;
//isRegPrice=true;
}
debitNoteAmount=getDebitNoteAmount(allowPercentage,rateInvoice,qtyInvoice,podRate,podQty);
System.out.println("Item code wise debit note :[ItemCode] :["+itemCode+"] :"+debitNoteAmount);
//actualDBamount=actualDBamount + debitNoteAmount;
......@@ -642,4 +684,63 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
}
private int getDBRowCount(Connection conn, String table_name, String whrCondCol, String whrCondVal)
{
int count=-1;
if(conn!=null){
ResultSet rs=null;
PreparedStatement pstmt = null;
String sql="select count(1) from "+table_name+" where "+whrCondCol+" = ?";
System.out.println("SQL in getDBRowCount method : "+sql);
try
{
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,whrCondVal);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
}
catch(SQLException e)
{
System.out.println("SQL Exception In getDBRowCount method of SalesEnquiry Class : "+e.getMessage());
e.printStackTrace();
}
catch(Exception ex)
{
System.out.println("Exception In getDBRowCount method of SalesEnquiry Class : "+ex.getMessage());
ex.printStackTrace();
}finally{
try{
if(pstmt!=null){
pstmt.close();
pstmt = null;
}
if(rs!=null){
rs.close();
rs = null;
}
}catch (SQLException se) {
se.printStackTrace();
}
}
}else{
try {
throw new SQLException("Connection passed to SalesEnquiry.getDBRowCount() method is null");
} catch (SQLException e) {
e.printStackTrace();
}
}
return count;
}
}
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