Commit 63ab00a8 authored by dpawar's avatar dpawar

Added source code as new requirement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93553 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0dd85b98
...@@ -17,6 +17,9 @@ import java.text.SimpleDateFormat; ...@@ -17,6 +17,9 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
...@@ -25,6 +28,7 @@ import org.w3c.dom.NodeList; ...@@ -25,6 +28,7 @@ import org.w3c.dom.NodeList;
@Stateless @Stateless
public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLocal,ProofOfDeliveryRemote public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLocal,ProofOfDeliveryRemote
{ {
String str,confirmedInv="";
public String wfValData(String xmlString, String xmlString1, String xmlString2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2,String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
System.out.println("------------ wfvalData method called-----------------"); System.out.println("------------ wfvalData method called-----------------");
...@@ -59,7 +63,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -59,7 +63,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
Node childNode = null; Node childNode = null;
int ctr=0; int ctr=0;
String childNodeName = null; String childNodeName = null;
String errString = "",errorType="",loginSite=""; String errString = "",errorType="",loginSite="",status="",invoiceID="",sreturnTranID="",sql1="";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt; PreparedStatement pstmt;
ResultSet rs=null; ResultSet rs=null;
...@@ -77,6 +81,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -77,6 +81,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
String userId=null,errCode=null; String userId=null,errCode=null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
...@@ -102,8 +107,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -102,8 +107,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
if (childNodeName.equalsIgnoreCase("invoice_id")) if (childNodeName.equalsIgnoreCase("invoice_id"))
{ {
String invoiceID="",invoiceConf=""; String invoiceConf="";
invoiceID = genericUtility.getColumnValue("invoice_id",dom); invoiceID = genericUtility.getColumnValue("invoice_id",dom);
str=invoiceID;
System.out.println("-----invoice id : "+invoiceID+" str--->"+str);
if(invoiceID==null || invoiceID.trim().length() == 0) if(invoiceID==null || invoiceID.trim().length() == 0)
{ {
errCode = "VTINVIDNN"; errCode = "VTINVIDNN";
...@@ -115,7 +122,9 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -115,7 +122,9 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
cnt= getDBRowCount(conn,"invoice","invoice_id",invoiceID); cnt= getDBRowCount(conn,"invoice","invoice_id",invoiceID);
int cnt1= getDBRowCount(conn,"spl_sales_por_hdr","invoice_id",invoiceID); int cnt1= getDBRowCount(conn,"spl_sales_por_hdr","invoice_id",invoiceID);
invoiceConf=getNameOrDescrForCode(conn, "invoice", "confirmed", "invoice_id", invoiceID); invoiceConf=getNameOrDescrForCode(conn, "invoice", "confirmed", "invoice_id", invoiceID);
System.out.println("invoiceConf--------->> 12121: "+invoiceConf); System.out.println("invoice Confirmed Status--------->> : "+invoiceConf);
String conf= getNameOrDescrForCode(conn,"spl_sales_por_hdr","confirmed","invoice_id",invoiceID);
conf=conf==null ? "" : conf.trim();
if(invoiceConf.trim().equalsIgnoreCase("N")) if(invoiceConf.trim().equalsIgnoreCase("N"))
{ {
//If invoice Id not confirmed in invoice master then show error //If invoice Id not confirmed in invoice master then show error
...@@ -123,16 +132,35 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -123,16 +132,35 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase()); errFields.add( childNodeName.toLowerCase());
} }
status=getNameOrDescrForCode(conn, "spl_sales_por_hdr", "wf_status", "invoice_id", invoiceID);
status=status==null ? "" : status.trim();
System.out.println("Status for reject ---->>["+status+"]");
if (!(editFlag.equals("E"))) if (!(editFlag.equals("E")))
{ {
if(cnt1 > 0) if(!(status.equals("R")))
{
if(isPartialyInvoiceChkHdr(conn,invoiceID))
{
//system has unconfirmed POD transaction for this invoice.
System.out.println("--------in partialy check condition--------");
errCode = "VTINVDUNF";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
else if(cnt1 > 0 && (!isPartialyInvoiceChk(conn,invoiceID)))
{ {
//If POD for invoiceID already exist in spl_sales_por_hdr then show error //If POD for invoiceID already exist in spl_sales_por_hdr then show error
System.out.println("-----IN 121212");
errCode = "VTINVIDAC"; errCode = "VTINVIDAC";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
} }
}
//------------------------------------------------------
if(cnt == 0) if(cnt == 0)
{ {
errCode = "VTINVIDNE"; errCode = "VTINVIDNE";
...@@ -144,7 +172,6 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -144,7 +172,6 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
if (childNodeName.equalsIgnoreCase("wf_status")) if (childNodeName.equalsIgnoreCase("wf_status"))
{ {
String wfStatus=""; String wfStatus="";
wfStatus = genericUtility.getColumnValue("wf_status",dom); wfStatus = genericUtility.getColumnValue("wf_status",dom);
wfStatus= wfStatus==null ?"":wfStatus; wfStatus= wfStatus==null ?"":wfStatus;
...@@ -166,27 +193,29 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -166,27 +193,29 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++) for(ctr = 0; ctr < childNodeListLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("quantity__resale")) if(childNodeName.equalsIgnoreCase("quantity__resale"))
{ {
String qtyResale="",qtyInv=""; String qtyResale="",qtyInv="",invoiceId="",itemCodeSret="";
double qtyResalD=0.0; double qtyResalD=0.0;
try
{
qtyResale=genericUtility.getColumnValue("quantity__resale", dom); qtyResale=genericUtility.getColumnValue("quantity__resale", dom);
qtyInv=genericUtility.getColumnValue("quantity__inv", dom); qtyInv=genericUtility.getColumnValue("quantity__inv", dom);
itemCodeSret =genericUtility.getColumnValue("item_code", dom);
itemCodeSret=itemCodeSret==null ? "" : itemCodeSret.trim();
System.out.println("itemCodeSret--->>["+itemCodeSret+"]");
try
{
qtyInv=qtyInv == null ? "0.0" : qtyInv; qtyInv=qtyInv == null ? "0.0" : qtyInv;
System.out.println("quantity__resale---->>"+qtyResale); System.out.println("quantity__resale---->>"+qtyResale);
qtyResale=checkSpaceNull(qtyResale); //qtyResale == null ? "0.0" : qtyResale; qtyResale=checkSpaceNull(qtyResale); //qtyResale == null ? "0.0" : qtyResale;
qtyResalD=Double.parseDouble(checkSpaceNull(qtyResale)); qtyResalD=Double.parseDouble(checkSpaceNull(qtyResale));
System.out.println("qtyInv---->>"+qtyInv+" qtyResaled after parsing :"+qtyResalD); System.out.println("qtyInv---->>"+qtyInv+" qtyResaled after parsing :"+qtyResalD);
if (qtyResale == null || qtyResale.trim().length() == 0 || qtyResalD <= 0) if (qtyResale == null || qtyResale.trim().length() == 0 || qtyResalD < 0)
{ {
errCode = "VTPODQNN"; errCode = "VTPODQNN";
errList.add( errCode ); errList.add( errCode );
...@@ -194,25 +223,123 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -194,25 +223,123 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
else else
{ {
System.out.println("------IN ELSE"); System.out.println("------IN ELSE-----------");
String tranID="";
double quantyInvD=0.0,podInvD=0.0,totalInvQty=0.0;
double qtyInvD=0.0,qtyResaleD=0.0; double qtyInvD=0.0,qtyResaleD=0.0;
qtyInvD=Double.parseDouble(checkSpaceNull(qtyInv)); qtyInvD=Double.parseDouble(checkSpaceNull(qtyInv));
qtyResaleD=Double.parseDouble(qtyResale); qtyResaleD=Double.parseDouble(qtyResale);
PreparedStatement pstmt1=null;
ResultSet rs1=null;
System.out.println("invoice Id dom---->>"+str);
sreturnTranID=getNameOrDescrForCode(conn, "sreturn", "tran_id", "invoice_id", str);
sreturnTranID=sreturnTranID==null ? "" : sreturnTranID.trim();
System.out.println("sreturnTranID --------->>["+sreturnTranID+"]");
if(sreturnTranID.length() > 0)
{
String sreturnItemCode="";
double sreturnQuantity=0.0;
sql1="select item_code,quantity from sreturndet where tran_id = ?";
pstmt=conn.prepareStatement(sql1);
pstmt.setString(1, sreturnTranID);
rs=pstmt.executeQuery();
while(rs.next())
{
sreturnItemCode=rs.getString(1);
sreturnQuantity=rs.getDouble(2);
System.out.println("sreturnItemCode -->["+sreturnItemCode+"] sreturnQuantity -->["+sreturnQuantity+"]");
if(sreturnItemCode.trim().equalsIgnoreCase(itemCodeSret))
{
qtyInvD=qtyInvD - sreturnQuantity;
System.out.println("Actual quantity after sales return---->>["+qtyInvD+"]");
if(qtyResalD > qtyInvD) //VTSLRETER
{
//Invoice quantity for item(s) is returned.Please check sales return.
errCode = "VTSLRETER";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase());
}
}
}
}
/*if(isPartialyInvoiceChk(conn,str))
{*/
System.out.println("in isPartialyInvoiceChk condition------------ ");
sql1="select tran_id from spl_sales_por_hdr where invoice_id = ?";
try
{
int count =1;
pstmt=conn.prepareStatement(sql1);
pstmt.setString(1, str);
rs = pstmt.executeQuery();
while(rs.next())
{
tranID=rs.getString(1);
tranID=tranID==null ? "" :tranID.trim();
System.out.println("No. of tran id travals [count]---->>: "+count+" TranID : "+tranID);
if(tranID.length() > 0)
{
sql1="";
sql1="select line_no,item_code,quantity__inv,quantity__resale from spl_sales_por_det where tran_id = ?";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1, tranID);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
quantyInvD=rs1.getDouble(3);
podInvD=rs1.getDouble(4);
System.out.println("Line no-->["+rs1.getInt(1)+"Item code -->["+rs1.getString(2));
System.out.println("quantyInvD -->["+quantyInvD+"] podInvD-->["+podInvD+"]");
totalInvQty=totalInvQty+podInvD;
}
System.out.println("----------Closing re1 and pstmt1 ----[totalInvQty]------["+totalInvQty+"]");
rs1.close();rs1=null;
pstmt1.close();pstmt1=null;
}
count++;
}
}
catch(Exception e)
{
System.out.println("");
e.printStackTrace();
}
//}
/*else
{
System.out.println("in isPartialyInvoiceChk [else] condition------------ ");
}*/
totalInvQty=totalInvQty+qtyResaleD;
System.out.println("qtyInvD---->> "+qtyInvD+" qtyResaleD : "+qtyResaleD); System.out.println("qtyInvD---->> "+qtyInvD+" qtyResaleD : "+qtyResaleD);
System.out.println("Final totalInvQty ----->"+totalInvQty );
if ( totalInvQty > qtyInvD)
{
System.out.println("the total qty condition true---------");
errCode = "VTPODGRT";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase());
}
if(qtyResaleD > qtyInvD) if(qtyResaleD > qtyInvD)
{ {
//POD quantity can not be greater than invoice quantity //POD quantity can not be greater than invoice quantity
errCode = "VTPODGRT"; errCode = "VTPODGRT";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase());
} }
} }
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println(); System.out.println("Exception : quantity__resale column (Detail) ");
e.printStackTrace(); e.printStackTrace();
} }
} }
if(childNodeName.equalsIgnoreCase("rate__resale")) if(childNodeName.equalsIgnoreCase("rate__resale"))
{ {
...@@ -230,7 +357,6 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -230,7 +357,6 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
} }
} }
break; break;
...@@ -273,8 +399,6 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -273,8 +399,6 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
errStringXml = new StringBuffer( "" ); errStringXml = new StringBuffer( "" );
} }
} //end try } //end try
catch (SQLException se) { catch (SQLException se) {
System.out.println("SQLException ::"+se); System.out.println("SQLException ::"+se);
...@@ -299,6 +423,11 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -299,6 +423,11 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
if(connDriver!=null){ if(connDriver!=null){
connDriver = null; connDriver = null;
} }
if(rs !=null)
{
rs.close();
rs=null;
}
} }
catch(Exception d) catch(Exception d)
...@@ -440,10 +569,8 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -440,10 +569,8 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
valueXmlString.append("<cust_name>").append("").append("</cust_name>"); valueXmlString.append("<cust_name>").append("").append("</cust_name>");
valueXmlString.append("<prd_code>").append("").append("</prd_code>"); valueXmlString.append("<prd_code>").append("").append("</prd_code>");
} }
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
case 2: case 2:
...@@ -555,12 +682,12 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -555,12 +682,12 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
catch(SQLException e) catch(SQLException e)
{ {
System.out.println("SQL Exception In getDBRowCount method of SalesEnquiry Class : "+e.getMessage()); System.out.println("SQL Exception In getDBRowCount method of ProofOfDelivery Class : "+e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
catch(Exception ex) catch(Exception ex)
{ {
System.out.println("Exception In getDBRowCount method of SalesEnquiry Class : "+ex.getMessage()); System.out.println("Exception In getDBRowCount method of ProofOfDelivery Class : "+ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
}finally{ }finally{
...@@ -580,7 +707,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -580,7 +707,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
}else{ }else{
try { try {
throw new SQLException("Connection passed to SalesEnquiry.getDBRowCount() method is null"); throw new SQLException("Connection passed to ProofOfDelivery.getDBRowCount() method is null");
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -589,6 +716,95 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -589,6 +716,95 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
return count; return count;
} }
/* This function check the partial invoice resell quantity if there is partial then return true
otherwise false. if any invoice not confirmed then return false */
private boolean isPartialyInvoiceChk(Connection conn,String invID)
{
System.out.println("---in method isPartialyInvoiceChk ------invoice ID :["+invID+"]");
PreparedStatement pstmt2 = null,pstmt1=null ;
ResultSet rs2 = null,rs1=null;
String sql1="",tranID="",confirmed="";
int lineNo=0,count=1;
invID=invID==null ? "" : invID.trim();
if (invID.length() <= 0)
{
return false;
}
double qtyInv=0.0,podQty=0.0;
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ?";
try
{
pstmt2=conn.prepareStatement(sql1);
pstmt2.setString(1, invID);
rs2 = pstmt2.executeQuery();
while(rs2.next())
{
tranID=rs2.getString(1);
confirmed=rs2.getString(2);
tranID=tranID==null ? "" : tranID.trim();
confirmed=confirmed==null ? "" :confirmed.trim();
System.out.println("Confirmed POD---->["+confirmed+"]");
System.out.println("tran id counter ------->"+count);
if(tranID.length() > 0 && confirmed.equalsIgnoreCase("Y"))
{
count++;
sql1="";
sql1="select line_no,item_code,quantity__inv,quantity__resale from spl_sales_por_det where tran_id = ?";
pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1, tranID);
rs1=pstmt1.executeQuery();
while(rs1.next())
{
lineNo=rs1.getInt(1);
qtyInv=rs1.getDouble(3);
podQty=rs1.getDouble(4);
System.out.println("Line no ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty);
if( podQty < qtyInv)
return true;
}
rs1.close();rs1=null;
pstmt1.close();pstmt1=null;
}
}
System.out.println("TranID in isPartialyInvoiceChk --->>["+tranID+"] confirmed -->["+confirmed+"]");
/*if (confirmed.equalsIgnoreCase("Y"))
return false;*/
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try{
if (rs2!=null)
{
rs2.close();
rs2=null;
}
if(pstmt2!=null)
{
pstmt2.close();
pstmt2=null;
}
}
catch(Exception e)
{
System.out.println("Exception : In finally block ");
e.printStackTrace();
}
}
return false;
}
private String errorType( Connection conn , String errorCode ) private String errorType( Connection conn , String errorCode )
{ {
...@@ -729,6 +945,77 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -729,6 +945,77 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
System.out.println("--------debitNoteCaclAmount------ :Debit note amount "+debitNoteCaclAmount); System.out.println("--------debitNoteCaclAmount------ :Debit note amount "+debitNoteCaclAmount);
}
private boolean isPartialyInvoiceChkHdr(Connection conn,String invID)
{
System.out.println("---in method isPartialyInvoiceChkHdr ------invoice ID :["+invID+"]");
PreparedStatement pstmt2 = null,pstmt1=null ;
ResultSet rs2 = null,rs1=null;
String sql1="",tranID="",confirmed="";
int lineNo=0,count=1;
invID=invID==null ? "" : invID.trim();
if (invID.length() <= 0)
{
return false;
}
double qtyInv=0.0,podQty=0.0;
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ?";
try
{
pstmt2=conn.prepareStatement(sql1);
pstmt2.setString(1, invID);
rs2 = pstmt2.executeQuery();
while(rs2.next())
{
tranID=rs2.getString(1);
confirmed=rs2.getString(2);
tranID=tranID==null ? "" : tranID.trim();
confirmed=confirmed==null ? "" :confirmed.trim();
System.out.println("Confirmed POD---->["+confirmed+"]");
if(confirmed.equalsIgnoreCase("N"))
return true;
System.out.println("tran id counter ------->"+count);
}
System.out.println("TranID in isPartialyInvoiceChk --->>["+tranID+"] confirmed -->["+confirmed+"]");
/*if (confirmed.equalsIgnoreCase("Y"))
return false;*/
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try{
if (rs2!=null)
{
rs2.close();
rs2=null;
}
if(pstmt2!=null)
{
pstmt2.close();
pstmt2=null;
}
}
catch(Exception e)
{
System.out.println("Exception : In finally block ");
e.printStackTrace();
}
}
return false;
} }
} }
...@@ -52,7 +52,7 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli ...@@ -52,7 +52,7 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
Connection conn=null; Connection conn=null;
ConnDriver ConnDriver = new ConnDriver(); ConnDriver ConnDriver = new ConnDriver();
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
String errString="",sql="",loginSite="",wfStatus="",itemCode="",regulatedPrice=""; String errString="",sql="",loginSite="",wfStatus="",itemCode="",regulatedPrice="",itemActive="";
String itmCodeDt2="",lotNo="",lotSl="", detail2xmlString=""; String itmCodeDt2="",lotNo="",lotSl="", detail2xmlString="";
double invRate=0.0,invQty=0.0,PODrate=0.0,PODqty=0.0,allowedAmt=0.0,stockistAmt=0.0,debitNoteAmtAct=0.0; double invRate=0.0,invQty=0.0,PODrate=0.0,PODqty=0.0,allowedAmt=0.0,stockistAmt=0.0,debitNoteAmtAct=0.0;
int updCnt=0,lineNo=0; int updCnt=0,lineNo=0;
...@@ -157,6 +157,17 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli ...@@ -157,6 +157,17 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
lotSl=rs.getString(8)== null ? "" : rs.getString(8); lotSl=rs.getString(8)== null ? "" : rs.getString(8);
System.out.println("lotNo :"+lotNo+"------->> invRate : "+invRate+" invQty : "+invQty+" PODrate : "+PODrate+ " PODqty : "+PODqty); System.out.println("lotNo :"+lotNo+"------->> invRate : "+invRate+" invQty : "+invQty+" PODrate : "+PODrate+ " PODqty : "+PODqty);
regulatedPrice=getColumnDescr(conn,"regulated_price","item","item_code",itemCode); regulatedPrice=getColumnDescr(conn,"regulated_price","item","item_code",itemCode);
itemActive=getColumnDescr(conn,"active","item","item_code",itemCode);
itemActive =itemActive==null ? "N" : itemActive.trim();
System.out.println("item active -------->>["+itemActive+"]");
//if item code is not active in item master then show error message
if(itemActive.equalsIgnoreCase("N"))
{
errString = itmdbAccess.getErrorString("", "VTITMCNAC", "", "", conn);
System.out.println("---------Error : item code["+itemCode+"] is not active in item master (Transaction Rollback)----------");
conn.rollback();
return errString;
}
//regulatedPrice if null then //regulatedPrice if null then
if(isRegulatePriceNull(conn,tranId)) if(isRegulatePriceNull(conn,tranId))
...@@ -633,15 +644,22 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli ...@@ -633,15 +644,22 @@ public class ProofOfDeliveryConf extends ActionHandlerEJB implements ProofOfDeli
allowPercentage=allowPercentage==null ? "0.0" :allowPercentage; allowPercentage=allowPercentage==null ? "0.0" :allowPercentage;
allowPercentageD=Double.parseDouble(allowPercentage); allowPercentageD=Double.parseDouble(allowPercentage);
invoiceAmt= rateInvoice * qtyInvoice;//10 *100 /*invoiceAmt= rateInvoice * qtyInvoice;//10 *100
percentageAmtInv= invoiceAmt * allowPercentageD/100; //1000 * 10/100 percentageAmtInv= invoiceAmt * allowPercentageD/100; //1000 * 10/100
actualAllowAmt= invoiceAmt + percentageAmtInv; //1100 actualAllowAmt= invoiceAmt + percentageAmtInv; //1100
System.out.println("getDebitNoteAmount -->> actualAllowAmt---------->> "+actualAllowAmt); System.out.println("getDebitNoteAmount -->> actualAllowAmt---------->> "+actualAllowAmt);
stockistAmt= podRate * podQty; //12 * 100 = 1200 stockistAmt= podRate * podQty; //12 * 100 = 1200 */
invoiceAmt= rateInvoice * podQty;//10 * 60 = 600
percentageAmtInv= invoiceAmt * allowPercentageD/100; //600 * 10/100=60
actualAllowAmt= invoiceAmt + percentageAmtInv; //660
System.out.println("getDebitNoteAmount -->> actualAllowAmt---------->> "+actualAllowAmt);
stockistAmt= podRate * podQty; //12 * 60 = 720
if(stockistAmt > actualAllowAmt) if(stockistAmt > actualAllowAmt)
debitNoteCaclAmount= stockistAmt - actualAllowAmt; //1200 -1100 =100 debitNoteCaclAmount= stockistAmt - actualAllowAmt; //720 - 660=60
else else
debitNoteCaclAmount=0.0; debitNoteCaclAmount=0.0;
......
...@@ -87,7 +87,7 @@ public class ProofOfDeliveryReject extends ActionHandlerEJB implements ProofOfDe ...@@ -87,7 +87,7 @@ public class ProofOfDeliveryReject extends ActionHandlerEJB implements ProofOfDe
sql="update spl_sales_por_hdr set wf_status = ?, emp_code__aprv = ? where tran_id = ? "; sql="update spl_sales_por_hdr set wf_status = ?, emp_code__aprv = ? where tran_id = ? ";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "R"); pstmt.setString(1, "R");
pstmt.setString(2, loginCode); pstmt.setString(2, loginCode);//E10808 loginCode
pstmt.setString(3, tranId); pstmt.setString(3, tranId);
updCnt=pstmt.executeUpdate(); updCnt=pstmt.executeUpdate();
if (updCnt > 0) if (updCnt > 0)
......
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