Commit a9e85abf authored by mmhatre's avatar mmhatre

gbfAutoCrnoteSreturnOth and gbfAutoMiscCrnoteSreturnOth methods migrated in java.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215733 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 21684624
......@@ -4271,7 +4271,8 @@ public class PostOrdInvoicePost extends ActionHandlerEJB implements PostOrdInvoi
pstmt.setString(79, InvoiceHrdMap.get("trans_mode"));
pstmt.setString(80, InvoiceHrdMap.get("gross_weight"));
pstmt.setString(81, InvoiceHrdMap.get("posttype"));
pstmt.setString(82, InvoiceHrdMap.get("parent__tran_id"));
// pstmt.setString(82, InvoiceHrdMap.get("parent__tran_id")); //commented by manish mhatre on 21-jan-2020
pstmt.setString(82, invoiceId); //added by manish mhatre on 21-jan-2020
pstmt.setString(83, InvoiceHrdMap.get("custstock_id"));
pstmt.setString(84, InvoiceHrdMap.get("inv_ackno"));
pstmt.setString(85, InvoiceHrdMap.get("cd_tranno"));
......
......@@ -8,6 +8,7 @@ import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvHoldGen;
import ibase.webitm.ejb.dis.PostOrdInvoicePost;
import ibase.webitm.ejb.dis.PostOrderActivity;
import ibase.webitm.ejb.dis.StockUpdate;
import ibase.webitm.ejb.fin.*;
......@@ -3728,6 +3729,8 @@ public class SalesReturnConfirm extends ActionHandlerEJB implements SalesReturnC
boolean adjInvoice = false;
boolean bIbca=false;
String sretFullRetType=null,tranType=null;
String siteType="",creatInvOthlist="",creatInvOth="",otherSite="",retString1="",refDate="" ; //added by manish mhatre
try
{
xmlBuff= new StringBuffer();
......@@ -4614,6 +4617,52 @@ public class SalesReturnConfirm extends ActionHandlerEJB implements SalesReturnC
if(errorString != null && errorString.indexOf("VTCICONF3") != -1)
{
errorString = "";
//added by manish mhatre on 20-jan-2020
//start manish
sql = " select site_type from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, as_site_code);
rs = pstmt.executeQuery();
if(rs.next())
{
siteType= checkNullAndTrim(rs.getString(1));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
creatInvOthlist = finCommon.getFinparams("999999", "ALOW_INV_OTH_SITE", conn);
if( "NULLFOUND".equalsIgnoreCase(creatInvOthlist) || creatInvOthlist == null)
{
creatInvOthlist="";
}
if(creatInvOthlist.trim().length() > 0)
{
String[] arrStr = creatInvOthlist.split(",");
for (int i = 0; i < arrStr.length; i++) {
creatInvOth = arrStr[i];
System.out.println("creatInvOth>>>>>>>>" + creatInvOth);
if(siteType.equalsIgnoreCase(creatInvOth.trim()))
{
otherSite = finCommon.getFinparams("999999", "INVOICE_OTHER_SITE", conn);
if( !"NULLFOUND".equalsIgnoreCase(creatInvOthlist) && creatInvOthlist != null && creatInvOthlist.trim().length() > 0)
{
errorString=gbfAutoCrnoteSreturnOth( drNtTranId, otherSite , refDate, xtraParams, conn);
if( errorString != null && errorString.trim().length() > 0 )
{
return errorString;
}
}
}
}
} //end manish
}
//Changed by wasim on 24-MAY-2017 to call gbfRetrieveDrCrRCP as previously gbfRetrieveDrCrInv login was migrated [END]
}
......@@ -4689,6 +4738,7 @@ public class SalesReturnConfirm extends ActionHandlerEJB implements SalesReturnC
StringBuffer xmlBuff = null;
String objName= "";
boolean lb_flag;
String siteType="",creatInvOthlist="",creatInvOth="",otherSite="",retString1="",refDate="" ; //added by manish mhatre
try
{
currDate = new java.sql.Timestamp(System.currentTimeMillis());
......@@ -5503,9 +5553,56 @@ public class SalesReturnConfirm extends ActionHandlerEJB implements SalesReturnC
errorString= confDebitNote.confirm(drNtTranId,xtraParams, "" , conn);
System.out.println("After DrCrRcpConf---->["+errorString+"]");
System.out.println("errorString["+errorString+"]");
PostOrdInvoicePost postOrdInvoicePost = new PostOrdInvoicePost();
if(errorString != null && errorString.indexOf("CONFSUCCES") != -1)
{
errorString = "";
//added by manish mhatre on 20-jan-2020
//start manish
sql = " select site_type from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, as_site_code);
rs = pstmt.executeQuery();
if(rs.next())
{
siteType= checkNullAndTrim(rs.getString(1));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
creatInvOthlist = finCommon.getFinparams("999999", "ALOW_INV_OTH_SITE", conn);
if( "NULLFOUND".equalsIgnoreCase(creatInvOthlist) || creatInvOthlist == null)
{
creatInvOthlist="";
}
if(creatInvOthlist.trim().length() > 0)
{
String[] arrStr = creatInvOthlist.split(",");
for (int i = 0; i < arrStr.length; i++) {
creatInvOth = arrStr[i];
System.out.println("creatInvOth>>>>>>>>" + creatInvOth);
if(siteType.equalsIgnoreCase(creatInvOth.trim()))
{
otherSite = finCommon.getFinparams("999999", "INVOICE_OTHER_SITE", conn);
if( !"NULLFOUND".equalsIgnoreCase(creatInvOthlist) && creatInvOthlist != null && creatInvOthlist.trim().length() > 0)
{
errorString=gbfAutoMiscCrnoteSreturnOth( drNtTranId, otherSite , xtraParams, conn);
if( errorString != null && errorString.trim().length() > 0 )
{
return errorString;
}
}
}
}
} //end manish
}
//ended arun
......@@ -5528,6 +5625,1583 @@ public class SalesReturnConfirm extends ActionHandlerEJB implements SalesReturnC
}
return errorString;
}
//added by manish mhatre on22-jan-2020
//start manish
public String gbfAutoCrnoteSreturnOth (String tranIdAs,String siteCodeAs,String refDate ,String xtraParams, Connection conn) throws Exception
{
String trnofld="" , finEntity="" , custCode="",acctCode="",cctrCode="" , invoiceId="", tranId="" ;
String currCode="" ,remarks="",analCode="",drcrFlag="",tranIdRcv="",confirmed="" ,siteCode="";
String empCodeAprv="",tranType="",tranSer="" , crTerm="" ,itemSer="" ,sreturnNo="",adjRecv="";
String gpSer="",gpNo="",parentTranId="",revTran="",custRefNo="",rndOff="",rndTo="",sundryType="";
String sundryCode="",siteCodeDrcr="",ediStat="" , drcrType="" , errcode="" , keystr="" ,tranwin="" , tranIdNew="";
String itemCode="" ,salesPers="" , taxChap="" , taxClass="",taxEnv="" ,reasCode="",lotNo="" , lotSl="";
String tranIdRcp="" , refSer="" , refNo="" , returnType="" , sretunTypeList="" , sretunType="" ;
String stanCode="" , stanCodeSite="";
String errString="";
Timestamp chgDate=null , tranDate=null,custRefDate=null ,effDate=null,confDate=null ,gpDate=null , dueDate=null;
double amount =0 , amountBc = 0 , roundAdj=0 ,custRefAmt=0,ordBillbackAmt=0,ordOffinvAmt=0;
double lineBillbackAmt=0 , lineOffinvAmt=0 ,drcrAmt=0 ,taxAmt= 0 ,netAmt = 0 ,quantity=0 ;
double discount=0,billbackAmt=0 ,offinvAmt=0 , refBalAmt=0 , adjAmt=0 , mrpValueAdj=0 , taxAmtdet = 0;
double tottax=0 , mtotamt = 0 , totdiscamt = 0 ,totNetAmt = 0;
double costRate=0 ,rateStd=0 ,rate=0 , rateClg=0;
double exchRate=0;
int lineNo=0, lineNoInv=0 ,lineNoSret=0 , lineNoInvtrace=0 , count=0 , i; //long
String taxEnvSr="",WINDOW="",parentTranIdAs="",temp="",objName="";
boolean lbFlag = false;
Timestamp taxDate=null;
String chgUser="",chgTerm="";
String transer = "CRNRCP";
trnofld = "tran_id";
//chg_date = datetime(today(),now())
String sql="",sql1="";
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
ResultSet rs = null;
ResultSet rs1 = null;
//ValidatorEJB vdt=new ValidatorEJB();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
DistCommon distCommon = new DistCommon();
//FinCommon finCommon = new FinCommon();
Timestamp currDate = null;
UtilMethods utilMethods = UtilMethods.getInstance();
StringBuffer xmlBuff = null;
try
{
currDate = new java.sql.Timestamp(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
xmlBuff = new StringBuffer();
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDateStr = sdfAppl.format(currDate);
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
sql="select tran_date,fin_entity,cust_code,acct_code,cctr_code,eff_date,invoice_id,amount, "+
" curr_code,exch_rate,remarks,site_code,anal_code,drcr_flag,tran_id__rcv,confirmed,conf_date, "+
" emp_code__aprv,tran_type,tran_ser,due_date,cr_term,amount__bc,item_ser,round_adj,sreturn_no, "+
" adj_recv,gp_ser,gp_no,gp_date,parent__tran_id,rev__tran,cust_ref_no,cust_ref_date,cust_ref_amt, "+
" rnd_off,rnd_to,sundry_type,sundry_code,site_code__drcr,drcr_type,ord_billback_amt,ord_offinv_amt, "+
" line_billback_amt,line_offinv_amt,edi_stat from drcr_rcp where tran_id = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, tranIdAs );
rs = pstmt.executeQuery();
while( rs.next() )
{
tranDate=rs.getTimestamp("tran_date");
finEntity=rs.getString("fin_entity");
custCode=rs.getString("cust_code");
acctCode=rs.getString("acct_code");
cctrCode=rs.getString("cctr_code");
effDate=rs.getTimestamp("eff_date");
invoiceId=rs.getString("invoice_id");
amount=rs.getDouble("amount");
currCode=rs.getString("curr_code");
exchRate=rs.getDouble("exch_rate");
remarks=checkNullAndTrim(rs.getString("remarks"));
siteCode=rs.getString("site_code");
analCode=checkNullAndTrim(rs.getString("anal_code"));
drcrFlag=rs.getString("drcr_flag");
tranIdRcv=checkNullAndTrim(rs.getString("tran_id__rcv"));
confirmed=rs.getString("confirmed");
confDate=rs.getTimestamp("conf_date");
empCodeAprv=rs.getString("emp_code__aprv");
tranType=rs.getString("tran_type");
tranSer=rs.getString("tran_ser");
dueDate=rs.getTimestamp("due_date");
crTerm=checkNullAndTrim(rs.getString("cr_term"));
amountBc=rs.getDouble("amount__bc");
itemSer=rs.getString("item_ser");
roundAdj=rs.getDouble("round_adj");
sreturnNo=rs.getString("sreturn_no");
adjRecv=rs.getString("adj_recv");
gpSer=checkNullAndTrim(rs.getString("gp_ser"));
gpNo=rs.getString("gp_no");
gpDate=rs.getTimestamp("gp_date");
parentTranId=rs.getString("parent__tran_id");
revTran=rs.getString("rev__tran");
//custRefNo=rs.getString("cust_ref_no");
// custRefDate=rs.getTimestamp("cust_ref_date");
//custRefAmt=rs.getDouble("cust_ref_amt");
rndOff=rs.getString("rnd_off");
rndTo=rs.getString("rnd_to");
sundryType=rs.getString("sundry_type");
sundryCode=rs.getString("sundry_code");
siteCodeDrcr=rs.getString("site_code__drcr");
drcrType=rs.getString("drcr_type");
ordBillbackAmt=rs.getDouble("ord_billback_amt");
ordOffinvAmt=rs.getDouble("ord_offinv_amt");
lineBillbackAmt=rs.getDouble("line_billback_amt");
lineOffinvAmt=rs.getDouble("line_offinv_amt");
ediStat=rs.getString("edi_stat");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ("D".equalsIgnoreCase(drcrFlag))
{
transer = "DRNRCP";
tranwin = "W_DRCRRCP_DR";
WINDOW = "T_DRCRRCP_DRHO";
}
else if ("C".equalsIgnoreCase(drcrFlag))
{
transer = "CRNRCP";
tranwin = "W_DRCRRCP_CR";
WINDOW = "T_DRCRRCP_CRHO";
}
/* if ("D".equalsIgnoreCase(drcr_flag))
{
// transer = 'DRNRCP'
WINDOW = "T_DRCRRCP_DRHO";
}
else if ("C".equalsIgnoreCase(drcr_flag) )
{
// transer = 'CRNRCP'
WINDOW = "T_DRCRRCP_CRHO";
}*/
sql="select key_string from transetup where upper(tran_window) = ? " ;
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, WINDOW);
rs=pstmt.executeQuery();
if (rs.next())
{
keystr=checkNullAndTrim(rs.getString("key_string"));
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (rs != null )
{
rs.close();
rs = null;
}
if(keystr == null || keystr.length() == 0)
{
sql = "select KEY_STRING from transetup where tran_window = 'GENERAL' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
keystr = checkNullAndTrim(rs.getString("KEY_STRING"));
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (rs != null )
{
rs.close();
rs = null;
}
}
/*String xmlValues = "",mpadjTranid="";
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id/>";
xmlValues = xmlValues + "<site_code>" + siteCodeAs + "</site_code>";
xmlValues = xmlValues + "<tran_date>"+ sdf.format(chg_date) + "</tran_date>";
xmlValues = xmlValues + "<tran_type>"+ sdf.format(tran_type) + "</tran_type>";
xmlValues = xmlValues + "</Detail1></Root>";
TransIDGenerator tg = new TransIDGenerator(xmlValues, "SYSTEM", CommonConstants.DB_NAME);
mpadjTranid = tg.generateTranSeqID(transer , trnofld,keystr, conn);*/
sql="select count(*) from site_customer where site_code__ch = ? and site_code = ? and channel_partner = 'Y' ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCodeAs);
pstmt.setString(2, siteCode);
rs=pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count==0)
{
sql="select count(*) from customer where site_code = ? and case when channel_partner is null then 'N' else channel_partner end = 'Y'";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCodeAs);
rs=pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt(1);
}
if(count > 1)
{
errString = itmDBAccessLocal.getErrorString("", "ERRORVTCPC", "","",conn);
return errString;
}
else if(count == 0)
{
errString = itmDBAccessLocal.getErrorString("", "VTCUSTCD4", "","",conn);
return errString;
}
else if(count == 1)
{
sql1 = "select cust_code from customer where site_code = ? and channel_partner = 'Y'" ;
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1,siteCodeAs);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
custCode = rs1.getString("cust_code");
}
rs1.close();rs1 = null;
pstmt1.close();pstmt1 = null;
}
}
else if(count == 1)
{
sql = "select cust_code from site_customer where site_code__ch = ? and site_code = ? and channel_partner = 'Y'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCodeAs);
pstmt.setString(2,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custCode = checkNull(rs.getString("cust_code"));
}
}
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
sql="select fin_entity from site where site_code= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCodeAs);
rs=pstmt.executeQuery();
if(rs.next())
{
finEntity=rs.getString("fin_entity");
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
sql="select invoice_id from invoice where parent__tran_id= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invoiceId);
rs=pstmt.executeQuery();
if(rs.next())
{
parentTranIdAs=rs.getString(1);
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(parentTranIdAs== null || parentTranIdAs.trim().length() == 0)
{
return errString;
}
/* sql=" insert into drcr_rcp (tran_id,tran_date,fin_entity,cust_code,acct_code,cctr_code,eff_date,invoice_id,amount, "
+" curr_code,exch_rate,remarks,site_code,anal_code,drcr_flag,tran_id__rcv,confirmed, "
+" emp_code__aprv,tran_type,tran_ser,due_date,cr_term,chg_date,chg_user,chg_term,add_date,add_user, "
+" add_term,amount__bc,item_ser,round_adj,sreturn_no,adj_recv,gp_ser,gp_no,gp_date,parent__tran_id, "
+" rev__tran,cust_ref_no,cust_ref_date,cust_ref_amt,rnd_off,rnd_to,sundry_type,sundry_code,site_code__drcr, "
+" drcr_type,ord_billback_amt,ord_offinv_amt,line_billback_amt,line_offinv_amt,edi_stat) "
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tran_id_new);
pstmt.setTimestamp(2, tran_date);
pstmt.setString(3, fin_entity);
pstmt.setString(4, cust_code);
pstmt.setString(5, acct_code);
pstmt.setString(6, cctr_code);
pstmt.setTimestamp(7, eff_date);
pstmt.setString(8, parent_tran_id);
pstmt.setDouble(9, amount);
pstmt.setString(10, curr_code);
pstmt.setDouble(11, exch_rate);
pstmt.setString(12, remarks);
pstmt.setString(13, site_code);
pstmt.setString(14,anal_code);
pstmt.setString(15, drcr_flag);
pstmt.setString(16, tran_id__rcv);
pstmt.setString(17, "N");
pstmt.setString(18, emp_code__aprv);
pstmt.setString(19, tran_type);
pstmt.setString(20, tran_ser);
pstmt.setTimestamp(21, due_date);
pstmt.setString(22, cr_term);
pstmt.setTimestamp(23, chg_date);
pstmt.setString(24, chgUser);
pstmt.setString(25, chgTerm);
pstmt.setTimestamp(26, chg_date);
pstmt.setString(27, chgUser);
pstmt.setString(28, chgTerm);
pstmt.setDouble(29, amount__bc);
pstmt.setString(30, item_ser);
pstmt.setDouble(31, 0);
pstmt.setString(32, sreturn_no);
pstmt.setString(33, adj_recv);
pstmt.setString(34, gp_ser);
pstmt.setString(35, gp_no);
pstmt.setTimestamp(36, gp_date);
pstmt.setString(37, tranIdAs);
pstmt.setString(38, rev__tran);
pstmt.setString(39, cust_ref_no);
pstmt.setTimestamp(40, cust_ref_date);
pstmt.setDouble(41, cust_ref_amt);
pstmt.setString(42, rnd_off);
pstmt.setString(43, rnd_to);
pstmt.setString(44, sundry_type);
pstmt.setString(45, cust_code);
pstmt.setString(46, site_code__drcr);
pstmt.setString(47, drcr_type);
pstmt.setDouble(48, ord_billback_amt);
pstmt.setDouble(49, ord_offinv_amt);
pstmt.setDouble(50, line_billback_amt);
pstmt.setDouble(51, line_offinv_amt);
pstmt.setString(52, edi_stat);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
xmlBuff.append("<?xml version='1.0' encoding='ISO-8859-1'?><DocumentRoot>");
xmlBuff.append("<description>Datawindow Root</description>");
xmlBuff.append("<group0>");
xmlBuff.append("<description>Group0 description</description>");
xmlBuff.append("<Header0>");
xmlBuff.append("<objName><![CDATA[").append("drcrrcp_cr").append("]]></objName>");
xmlBuff.append("<pageContext><![CDATA[").append("1").append("]]></pageContext>");
xmlBuff.append("<objContext><![CDATA[").append("1").append("]]></objContext>");
xmlBuff.append("<editFlag><![CDATA[").append("A").append("]]></editFlag>");
xmlBuff.append("<focusedColumn><![CDATA[").append("").append("]]></focusedColumn>");
xmlBuff.append("<action><![CDATA[").append("SAVE").append("]]></action>");
xmlBuff.append("<elementName><![CDATA[").append("").append("]]></elementName>");
xmlBuff.append("<keyValue><![CDATA[").append("1").append("]]></keyValue>");
xmlBuff.append("<taxKeyValue><![CDATA[").append("").append("]]></taxKeyValue>");
xmlBuff.append("<saveLevel><![CDATA[").append("1").append("]]></saveLevel>");
xmlBuff.append("<forcedSave><![CDATA[").append(true).append("]]></forcedSave>");
xmlBuff.append("<taxInFocus><![CDATA[").append(false).append("]]></taxInFocus>");
xmlBuff.append("<description>Header0 members</description>");
xmlBuff.append("<Detail1 dbID=\"\" domID=\"1\" objContext=\"1\" objName=\"drcrrcp_cr\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
//xmlBuff.append("<tran_id>").append("<![CDATA[" + tranIdNew + "]]>").append("</tran_id>");
xmlBuff.append("<tran_date>").append("<![CDATA[" + sdfAppl.format(currDate).toString() + "]]>").append("</tran_date>");
xmlBuff.append("<fin_entity>").append("<![CDATA[" + finEntity + "]]>").append("</fin_entity>");
xmlBuff.append("<cust_code>").append("<![CDATA[" + custCode + "]]>").append("</cust_code>");
xmlBuff.append("<acct_code>").append("<![CDATA[" + acctCode + "]]>").append("</acct_code>");
xmlBuff.append("<cctr_code>").append("<![CDATA[" + cctrCode + "]]>").append("</cctr_code>");
if(effDate !=null)
{
xmlBuff.append("<eff_date>").append("<![CDATA[" + sdfAppl.format(effDate).toString() + "]]>").append("</eff_date>");
}
xmlBuff.append("<invoice_id>").append("<![CDATA[" + parentTranIdAs + "]]>").append("</invoice_id>");
xmlBuff.append("<amount>").append("<![CDATA[" + amount + "]]>").append("</amount>");
xmlBuff.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
xmlBuff.append("<exch_rate>").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>");
xmlBuff.append("<remarks>").append("<![CDATA[" + remarks +"]]>").append("</remarks>");
xmlBuff.append("<site_code>").append("<![CDATA[" + siteCodeAs + "]]>").append("</site_code>");
xmlBuff.append("<anal_code>").append("<![CDATA[" + analCode + "]]>").append("</anal_code>");
xmlBuff.append("<drcr_flag>").append("<![CDATA[" + drcrFlag + "]]>").append("</drcr_flag>");
xmlBuff.append("<tran_id__rcv>").append("<![CDATA[" + tranIdRcv + "]]>").append("</tran_id__rcv>");
xmlBuff.append("<confirmed>").append("<![CDATA[" + "N" + "]]>").append("</confirmed>");
xmlBuff.append("<emp_code__aprv>").append("<![CDATA[" + empCodeAprv + "]]>").append("</emp_code__aprv>");
xmlBuff.append("<tran_type>").append("<![CDATA[" + tranType + "]]>").append("</tran_type>");
xmlBuff.append("<tran_ser>").append("<![CDATA[" + tranSer + "]]>").append("</tran_ser>");
if(dueDate !=null)
{
xmlBuff.append("<due_date>").append("<![CDATA[" + sdfAppl.format(dueDate).toString() + "]]>").append("</due_date>");
}
xmlBuff.append("<cr_term>").append("<![CDATA[" + crTerm + "]]>").append("</cr_term>");
xmlBuff.append("<chg_date>").append("<![CDATA[" + sdfAppl.format(currDate).toString() + "]]>").append("</chg_date>");
xmlBuff.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
xmlBuff.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
xmlBuff.append("<add_date>").append("<![CDATA[" + sdfAppl.format(currDate).toString() + "]]>").append("</add_date>");
xmlBuff.append("<add_user>").append("<![CDATA[" + chgUser + "]]>").append("</add_user>");
xmlBuff.append("<add_term>").append("<![CDATA[" + chgTerm + "]]>").append("</add_term>");
xmlBuff.append("<amount__bc>").append("<![CDATA[" +amountBc + "]]>").append("</amount__bc>");
xmlBuff.append("<item_ser>").append("<![CDATA[" + itemSer+ "]]>").append("</item_ser>");
xmlBuff.append("<round_adj>").append("<![CDATA[" + 0 + "]]>").append("</round_adj>");
xmlBuff.append("<sreturn_no>").append("<![CDATA[" + "" + "]]>").append("</sreturn_no>");
xmlBuff.append("<adj_recv>").append("<![CDATA[" + adjRecv + "]]>").append("</adj_recv>");
xmlBuff.append("<gp_ser>").append("<![CDATA[" + gpSer + "]]>").append("</gp_ser>");
xmlBuff.append("<gp_no>").append("<![CDATA[" + gpNo + "]]>").append("</gp_no>");
if(gpDate !=null)
{
xmlBuff.append("<gp_date>").append("<![CDATA[" + sdfAppl.format(gpDate).toString() + "]]>").append("</gp_date>");
}
xmlBuff.append("<parent__tran_id>").append("<![CDATA[" + tranIdAs + "]]>").append("</parent__tran_id>");
xmlBuff.append("<rev__tran>").append("<![CDATA[" + revTran + "]]>").append("</rev__tran>");
//xmlBuff.append("<cust_ref_no>").append("<![CDATA[" + custRefNo + "]]>").append("</cust_ref_no>");
/*if(custRefDate !=null)
{
xmlBuff.append("<cust_ref_date>").append("<![CDATA[" + sdfAppl.format(custRefDate).toString() + "]]>").append("</cust_ref_date>");
}*/
//xmlBuff.append("<cust_ref_amt>").append("<![CDATA[" + custRefAmt + "]]>").append("</cust_ref_amt>");
xmlBuff.append("<rnd_off>").append("<![CDATA[" + rndOff + "]]>").append("</rnd_off>");
xmlBuff.append("<rnd_to>").append("<![CDATA[" + rndTo + "]]>").append("</rnd_to>");
xmlBuff.append("<sundry_type>").append("<![CDATA[" + sundryType + "]]>").append("</sundry_type>");
xmlBuff.append("<sundry_code>").append("<![CDATA[" + custCode + "]]>").append("</sundry_code>");
xmlBuff.append("<site_code__drcr>").append("<![CDATA[" + siteCodeDrcr + "]]>").append("</site_code__drcr>");
xmlBuff.append("<drcr_type>").append("<![CDATA[" + drcrType + "]]>").append("</drcr_type>");
xmlBuff.append("<ord_billback_amt>").append("<![CDATA[" + ordBillbackAmt + "]]>").append("</ord_billback_amt>");
xmlBuff.append("<ord_offinv_amt>").append("<![CDATA[" + ordOffinvAmt + "]]>").append("</ord_offinv_amt>");
xmlBuff.append("<line_billback_amt>").append("<![CDATA[" + lineBillbackAmt + "]]>").append("</line_billback_amt>");
xmlBuff.append("<line_offinv_amt>").append("<![CDATA[" + lineOffinvAmt + "]]>").append("</line_offinv_amt>");
xmlBuff.append("<edi_stat>").append("<![CDATA[" + ediStat + "]]>").append("</edi_stat>");
xmlBuff.append("</Detail1>");
xmlBuff.append("\n");
sql="select tran_type,tax_date from sreturn where tran_id= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, sreturnNo);
rs=pstmt.executeQuery();
if(rs.next())
{
returnType=rs.getString("tran_type");
taxDate=rs.getTimestamp("tax_date");
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(taxDate == null) //if isnull(ld_tax_date) or string(ld_tax_date,'ddmmyyyy') = '01011900' then ld_tax_date = ld_tran_date
{
taxDate=tranDate;
}
taxEnvSr=(finCommon.getFinparams("999999","SRETURN_TAX_ENV",conn));
if("NULLFOUND".equalsIgnoreCase(taxEnvSr) || taxEnvSr == null || taxEnvSr.trim().length() ==0 )
{
taxEnvSr="";
}
lbFlag=false;
sretunTypeList=(distCommon.getDisparams("999999", "SRETURN_TYPE", conn));
if("NULLFOUND".equalsIgnoreCase(sretunTypeList)|| sretunTypeList == null || sretunTypeList.trim().length() ==0 )
{
sretunTypeList="";
}
String sreturn_type[]=sretunTypeList.split(",");
if(sreturn_type.length > 0)
{
for (i = 0; i < sreturn_type.length; i++) {
if((returnType.trim()).equalsIgnoreCase(sretunType) )
{
lbFlag=true;
}
}
}
sql="select line_no,invoice_id,line_no__inv,item_code,sales_pers,tax_class,tax_chap, " +
" tax_env,drcr_amt,tax_amt,net_amt,reas_code,cost_rate,rate__std,quantity,rate,rate__clg, " +
" discount,line_no__sret,line_no__invtrace,lot_no,lot_sl,tran_id__rcp,billback_amt,offinv_amt " +
" from drcr_rdet " +
" where tran_id = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranIdAs);
rs=pstmt.executeQuery();
while(rs.next())
{
lineNo=rs.getInt("line_no");
invoiceId=rs.getString("invoice_id");
lineNoInv=rs.getInt("line_no__inv");
itemCode=rs.getString("item_code");
salesPers=rs.getString("sales_pers");
taxClass=rs.getString("tax_class");
taxChap=rs.getString("tax_chap");
taxEnv=rs.getString("tax_env");
drcrAmt=rs.getDouble("drcr_amt");
taxAmt=rs.getDouble("tax_amt");
netAmt=rs.getDouble("net_amt");
reasCode=rs.getString("reas_code");
costRate=rs.getDouble("cost_rate");
rateStd=rs.getDouble("rate__std");
quantity=rs.getDouble("quantity");
rate=rs.getDouble("rate");
rateClg=rs.getDouble("rate__clg");
discount=rs.getDouble("discount");
lineNoSret=rs.getInt("line_no__sret");
lineNoInvtrace=rs.getInt("line_no__invtrace");
lotNo=rs.getString("lot_no");
lotSl=rs.getString("lot_sl");
tranIdRcp=checkNullAndTrim(rs.getString("tran_id__rcp"));
billbackAmt=rs.getDouble("billback_amt");
offinvAmt=rs.getDouble("offinv_amt");
if(netAmt==0)
{
netAmt=0;
}
if(amount==0)
{
amount=0;
netAmt=netAmt-taxAmt;
}
if(!lbFlag)
{
taxEnvSr=taxEnv;
}
xmlBuff.append("<Detail2 dbID=\"\" domID=\""+lineNo+"\" objContext=\"2\" objName=\"drcrrcp_cr\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
//xmlBuff.append("<tran_id>").append("<![CDATA[" + tranIdNew + "]]>").append("</tran_id>");
xmlBuff.append("<line_no>").append("<![CDATA[" + lineNo + "]]>").append("</line_no>");
xmlBuff.append("<invoice_id>").append("<![CDATA[" + parentTranIdAs + "]]>").append("</invoice_id>");
xmlBuff.append("<line_no__inv>").append("<![CDATA[" + lineNoInv + "]]>").append("</line_no__inv>");
xmlBuff.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
xmlBuff.append("<sales_pers>").append("<![CDATA[" + salesPers + "]]>").append("</sales_pers>");
xmlBuff.append("<tax_class>").append("<![CDATA[" + taxClass + "]]>").append("</tax_class>");
xmlBuff.append("<tax_chap>").append("<![CDATA[" + taxChap + "]]>").append("</tax_chap>");
xmlBuff.append("<tax_env>").append("<![CDATA[" + taxEnvSr + "]]>").append("</tax_env>");
xmlBuff.append("<drcr_amt>").append("<![CDATA[" + drcrAmt + "]]>").append("</drcr_amt>");
xmlBuff.append("<tax_amt>").append("<![CDATA[" + taxAmt + "]]>").append("</tax_amt>");
xmlBuff.append("<net_amt>").append("<![CDATA[" + netAmt + "]]>").append("</net_amt>");
xmlBuff.append("<reas_code>").append("<![CDATA[" + reasCode + "]]>").append("</reas_code>");
xmlBuff.append("<cost_rate>").append("<![CDATA[" + costRate + "]]>").append("</cost_rate>");
xmlBuff.append("<rate__std>").append("<![CDATA[" + rateStd + "]]>").append("</rate__std>");
xmlBuff.append("<quantity>").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
xmlBuff.append("<rate>").append("<![CDATA[" +rate + "]]>").append("</rate>");
xmlBuff.append("<rate_clg>").append("<![CDATA[" + rateClg + "]]>").append("</rate_clg>");
xmlBuff.append("<discount>").append("<![CDATA[" + discount + "]]>").append("</discount>");
xmlBuff.append("<line_no__sret>").append("<![CDATA[" + lineNoSret + "]]>").append("</line_no__sret>");
xmlBuff.append("<line_no__invtrace>").append("<![CDATA[" + lineNoInvtrace + "]]>").append("</line_no__invtrace>");
xmlBuff.append("<lot_no>").append("<![CDATA[" + (lotNo) + "]]>").append("</lot_no>");
xmlBuff.append("<lot_sl>").append("<![CDATA[" + (lotSl) + "]]>").append("</lot_sl>");
xmlBuff.append("<tran_id__rcp>").append("<![CDATA[" + tranIdRcp + "]]>").append("</tran_id__rcp>");
xmlBuff.append("<billback_amt>").append("<![CDATA[" + billbackAmt + "]]>").append("</billback_amt>");
xmlBuff.append("<offinv_amt>").append("<![CDATA[" + offinvAmt + "]]>").append("</offinv_amt>");
xmlBuff.append("</Detail2>");
xmlBuff.append("\n");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//System.out.println("--xmlString--"+xmlBuff.toString());
/*errorString = saveData(xtraParams,siteCodeAs,xmlBuff.toString(),conn);
//System.out.println("@@@@@2: retString:"+errorString);
//System.out.println("--retString finished--");
if (errorString.indexOf("Success") > -1)
{
// System.out.println("@@@@@@3: Success"+errorString);
Document dom = genericUtility.parseString(errorString);
//System.out.println("dom>>>"+dom);
drNtTranId = genericUtility.getColumnValue("TranID",dom);
}
else
{
//System.out.println("[SuccessSuccess" + errorString + "]");
conn.rollback();
return errorString;
}*/
/*if(tax_env_sr.trim().length()>0 && tax_env_sr!=null)
{
if(lbFlag=true)
{
lds_drcr_rcp_det.retrieve(ls_tran_id_new , ll_line_no)
ds_tax_detbrow.reset()
//lc_tax_amtdet = gf_calc_tax_ds(lds_drcr_rcp_det,ds_tax_detbrow,transer,ls_tran_id_new,ld_tax_date,"rate", "quantity",0,ls_curr_code,'2')
}
else
{
ds_salesreturn_retnline.retrieve(ls_sreturn_no , ll_line_no__sret)
ds_salesreturn_retnline.setitem(1,'line_no',ll_line_no)
ds_tax_detbrow.reset()
lc_tax_amtdet = gf_calc_tax_ds(ds_salesreturn_retnline,ds_tax_detbrow,transer,ls_tran_id_new,ld_tax_date,"rate__stduom", "quantity__stduom",0,ls_curr_code,'2')
}
}*/
/*if(taxAmtdet==0 ) // if isnull(lc_tax_amtdet) or lc_tax_amtdet = -999999999 then lc_tax_amtdet = 0
{
taxAmtdet=0;
}
if(netAmt==0)
{
netAmt=0;
}
if(totNetAmt==0)
{
totNetAmt=0;
}
if(mtotamt==0)
{
mtotamt=0;
}
if(totdiscamt==0)
{
totdiscamt=0;
}
totNetAmt=totNetAmt+netAmt+taxAmtdet;
sql=" update drcr_rdet" +
" set tax_amt = ?, " +
" net_amt = (net_amt + (? - ?)) " +
" where tran_id = ? " +
" and line_no = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1,taxAmtdet);
pstmt.setDouble(2,taxAmtdet);
pstmt.setDouble(3,discount);
pstmt.setString(4,tranIdNew);
pstmt.setInt(5, lineNo);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;*/
sql="select line_no,ref_ser,ref_no,ref_bal_amt,adj_amt,mrp_value__adj "+
" from drcr_rcpinv where tran_id= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranIdAs);
rs=pstmt.executeQuery();
while(rs.next())
{
lineNo=rs.getInt("line_no");
refSer=rs.getString("ref_ser");
refNo=rs.getString("ref_no");
refBalAmt=rs.getDouble("ref_bal_amt");
adjAmt=rs.getDouble("adj_amt");
mrpValueAdj=rs.getDouble("mrp_value__adj");
/*
sql="insert into drcr_rcpinv (tran_id, line_no,ref_ser,ref_no,ref_bal_amt,adj_amt,mrp_value__adj) "+
" Values (?,?,?,?,?,?,?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdNew);
pstmt.setInt(2, lineNo);
pstmt.setString(3, refSer);
pstmt.setString(4, refNo);
pstmt.setDouble(5, refBalAmt);
pstmt.setDouble(6, adjAmt);
pstmt.setDouble(7, mrpValueAdj);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
xmlBuff.append("<Detail3 dbID=\"\" domID=\""+lineNo+"\" objContext=\"3\" objName=\"drcrrcp_cr\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
// xmlBuff.append("<tran_id><![CDATA["+ tranIdNew +"]]></tran_id>");
xmlBuff.append("<line_no><![CDATA["+ lineNo +"]]></line_no>");
xmlBuff.append("<ref_ser><![CDATA["+ refSer +"]]></ref_ser>");
xmlBuff.append("<ref_no><![CDATA["+ refNo +"]]></ref_no>");
xmlBuff.append("<ref_bal_amt><![CDATA["+ refBalAmt +"]]></ref_bal_amt>");
xmlBuff.append("<adj_amt><![CDATA["+ adjAmt +"]]></adj_amt>");
xmlBuff.append("<mrp_val__adj><![CDATA["+ mrpValueAdj +"]]></mrp_val__adj>");
xmlBuff.append("</Detail3>");
/*sql="update drcr_rcp " +
" set AMOUNT = ?, " +
" AMOUNT__BC = ? " +
" where tran_id = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1,totNetAmt);
pstmt.setDouble(2,totNetAmt);
pstmt.setString(3,tranIdNew);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;*/
/*
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
String xmlString = xmlBuff.toString().trim().replaceFirst("^([\\W]+)<","<");
String drNtTranId="";
// errString = saveData(xtraParams,siteCodeAs,xmlString,conn);
*/
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
errString = saveData(xtraParams,siteCodeAs,xmlBuff.toString(),conn);
//System.out.println("@@@@@2: retString:"+errorString);
//System.out.println("--retString finished--");
if (errString.indexOf("Success") > -1)
{
System.out.println("@@@@@@3: Success"+errString);
Document dom = genericUtility.parseString(errString);
//System.out.println("dom>>>"+dom);
tranIdNew = genericUtility.getColumnValue("TranID",dom);
}
else
{
//System.out.println("[SuccessSuccess" + errorString + "]");
conn.rollback();
return errString;
}
//errString = nvo_misc.gbf_retrieve_misc_drcr_rcp(ls_tran_id_new, ls_tran_id_new,1,siteCodeAs);
DrCrRcpConf drcrObj = new DrCrRcpConf();
errString = drcrObj.confirm (tranIdNew, xtraParams, "" , conn);
//System.out.println("After DrCrRcpConf---->["+errorString+"]");
if(errString != null && errString.indexOf("VTCICONF3") != -1)
{
errString = "";
}
if(errString.trim().length()==0)
{
sql=" update sreturn "+
" set tran_id__crn = ? "+
" where tran_id = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranIdAs);
pstmt.setString(2,sreturnNo);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}//end manish
//added by manish mhatre on22-jan-2020
//start manish
public String gbfAutoMiscCrnoteSreturnOth(String tranIdAs,String siteCodeAs,String xtraParams, Connection conn) throws Exception
{
String trnofld="" , finEntity="" , custCode="",acctCode="",cctrCode="" , invoiceId="", tranId="" ;
String currCode="" ,remarks="",analCode="",drcrFlag="",tranIdRcv="",confirmed="" ,siteCode="";
String empCodeAprv="",tranType="",tranSer="" , crTerm="" ,itemSer="" ,sreturnNo="",adjRecv="";
String gpSer="",gpNo="",parentTranId="",revTran="",custRefNo="",rndOff="",sundryType=""; //,rnd_to=""
String sundryCode="",siteCodeDrcr="",ediStat="" , drcrType="" , errcode="" , keystr="" ,tranwin="" , tranIdNew="";
String itemCode="" ,salesPers="" , taxChap="" , taxClass="",taxEnv="" ,reasCode="",lotNo="" , lotSl="";
String tranIdRcp="" , refSer="" , refNo="" , returnType="" , sretunTypeList="" , sretunType="",adjmisccrn="" ;
String refNoCr="" ,wfStatus="",custCodeDlv="" , custCodePord="" , saleOrder="" ,custPord="" , empCode="";
String analysis1="",analysis2="",analysis3="",unit="" , refSerRcpinv="",refNoRcpinv="",stanCode="",stanCodeSite="";
Timestamp chgDate=null , tranDate=null,custRefDate=null ,effDate=null,confDate=null ,gpDate=null , dueDate=null ,pordDate=null;
double amount =0 , amountBc = 0 , roundAdj=0 ,custRefAmt=0,ordBillbackAmt=0,ordOffinvAmt=0;
double lineBillbackAmt=0 , lineOffinvAmt=0 ,drcrAmt=0 ,taxAmt=0 ,netAmt = 0 ,quantity=0 ;
double discount=0,billbackAmt=0 ,offinvAmt=0 , refBalAmt=0 , adjAmt=0 , mrpValueAdj=0,adjAmount=0;
double rndTo=0 , refBalAmtRcpinv=0,adjAmtRcpinv=0,mrpValueAdjRcpinv=0,taxAmtdet=0 , tottax=0 , totdiscamt=0;
double amountdet= 0 , totNetAmt=0;
double costRate=0 ,rateStd=0 ,rate=0 , rateClg=0;
double exchRate=0;
int lineNo=0 , lineNoInv=0 ,lineNoSret=0 , lineNoInvtrace=0 , count=0 , lineNoRcpinv=0 , i=0;
String taxEnvSr="", window="",objName="";
boolean lbFlag = false;
Timestamp taxDate=null;
String temp="";
String chgUser="",chgTerm="",errString="";
String transer = "MDRCRC";
trnofld = "tran_id";
//chg_date = datetime(today(),now());
String sql="",sql1="";
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
ResultSet rs = null;
ResultSet rs1 = null;
//ValidatorEJB vdt=new ValidatorEJB();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
DistCommon distCommon = new DistCommon();
//FinCommon finCommon = new FinCommon();
Timestamp currDate = null;
UtilMethods utilMethods = UtilMethods.getInstance();
StringBuffer xmlBuff = null;
try
{
currDate = new java.sql.Timestamp(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
xmlBuff = new StringBuffer();
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDateStr = sdfAppl.format(currDate);
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
sql="select tran_ser,tran_date,eff_date,fin_entity,site_code,sundry_type, "+
" sundry_code,acct_code,cctr_code,amount,curr_code,exch_rate,remarks,drcr_flag, "+
" tran_id__rcv,confirmed,conf_date,emp_code__aprv,due_date,tran_type,item_ser, "+
" amount__bc,sreturn_no,adj_misc_crn,adj_amount,parent__tran_id,rev__tran,round_adj, "+
" cust_ref_no,cust_ref_date,cust_ref_amt,rnd_off,rnd_to,ref_no__cr,wf_status, "+
" cust_code__dlv,cust_pord,pord_date,edi_stat,sale_order from misc_drcr_rcp where tran_id = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, tranIdAs );
rs = pstmt.executeQuery();
while( rs.next() )
{
transer=rs.getString("tran_ser");
tranDate=rs.getTimestamp("tran_date");
effDate=rs.getTimestamp("eff_date");
finEntity=rs.getString("fin_entity");
siteCode=rs.getString("site_code");
sundryType=rs.getString("sundry_type");
sundryCode=rs.getString("sundry_code");
acctCode=checkNullAndTrim(rs.getString("acct_code"));
cctrCode=rs.getString("cctr_code");
amount=rs.getDouble("amount");
currCode=rs.getString("curr_code");
exchRate=rs.getDouble("exch_rate");
remarks=checkNullAndTrim(rs.getString("remarks"));
drcrFlag=rs.getString("drcr_flag");
tranIdRcv=checkNullAndTrim(rs.getString("tran_id__rcv"));
confirmed=rs.getString("confirmed");
confDate=rs.getTimestamp("conf_date");
empCodeAprv=rs.getString("emp_code__aprv");
dueDate=rs.getTimestamp("due_date");
tranType=rs.getString("tran_type");
itemSer=rs.getString("item_ser");
amountBc=rs.getDouble("amount__bc");
sreturnNo=rs.getString("sreturn_no");
adjmisccrn=rs.getString("adj_misc_crn");
adjAmount=rs.getDouble("adj_amount");
parentTranId=rs.getString("parent__tran_id");
revTran=rs.getString("rev__tran");
roundAdj=rs.getDouble("round_adj");
custRefNo=rs.getString("cust_ref_no");
custRefDate=rs.getTimestamp("cust_ref_date");
custRefAmt=rs.getDouble("cust_ref_amt");
rndOff=rs.getString("rnd_off");
rndTo=rs.getDouble("rnd_to");
refNoCr=rs.getString("ref_no__cr");
wfStatus=rs.getString("wf_status");
custCodeDlv=rs.getString("cust_code__dlv");
custPord=rs.getString("cust_pord");
pordDate=rs.getTimestamp("pord_date");
ediStat=rs.getString("edi_stat");
saleOrder=rs.getString("sale_order");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ("D".equalsIgnoreCase(drcrFlag))
{
transer = "MDRCRD";
tranwin = "W_MISC_DRCR_RCP_DR";
window = "T_MISC_DRCR_RCP_DRHO";
}
else if ("C".equalsIgnoreCase(drcrFlag))
{
transer = "MDRCRC";
tranwin = "W_MISC_DRCR_RCP_CR";
window = "T_MISC_DRCR_RCP_CRHO";
}
sql="select key_string from transetup where upper(tran_window) = ? " ;
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,window);
rs=pstmt.executeQuery();
if (rs.next())
{
keystr=checkNullAndTrim(rs.getString("key_string"));
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (rs != null )
{
rs.close();
rs = null;
}
if(keystr == null || keystr.length() == 0)
{
sql = "select KEY_STRING from transetup where tran_window = 'GENERAL' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
keystr = checkNullAndTrim(rs.getString("KEY_STRING"));
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (rs != null )
{
rs.close();
rs = null;
}
}
/* String xmlValues = "",mpadjTranid="";
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id/>";
xmlValues = xmlValues + "<site_code>" + siteCodeAs + "</site_code>";
xmlValues = xmlValues + "<tran_date>"+ sdf.format(currDate) + "</tran_date>";
xmlValues = xmlValues + "<tran_type>"+ sdf.format(tran_type) + "</tran_type>";
xmlValues = xmlValues + "</Detail1></Root>";
TransIDGenerator tg = new TransIDGenerator(xmlValues, "SYSTEM", CommonConstants.DB_NAME);
mpadjTranid = tg.generateTranSeqID(transer,trnofld,keystr, conn);*/
/*lds_keygen = create nvo_datastore
lds_keygen.dataobject = 'd_genkey_temp'
lds_keygen.insertrow(0)
lds_keygen.setitem(1,"site_code", siteCodeAs)
lds_keygen.setitem(1,"tran_date", ld_chg_date)
lds_keygen.setitem(1,"tran_type", ls_tran_type)
ls_tran_id_new = gf_gen_key_nvo(lds_keygen,transer, trnofld, keystr)
destroy lds_keygen*/
/*if ls_tran_id_new = 'ERROR' then
populateerror(9999,'populateerror')
ls_errcode = 'VTTRANID' + ' ~t for tran. series :' + transer
ls_errcode = gf_error_location(ls_errcode)
end if*/
sql="select count(*) from site_customer where site_code__ch = ? and site_code = ? and channel_partner = 'Y' ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCodeAs);
pstmt.setString(2, siteCode);
rs=pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(count==0)
{
sql="select count(*) from customer where site_code = ? and case when channel_partner is null then 'N' else channel_partner end = 'Y'";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCodeAs);
rs=pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt(1);
}
if(count > 1)
{
errString = itmDBAccessLocal.getErrorString("", "ERRORVTCPC", "","",conn);
return errString;
}
else if(count == 0)
{
errString = itmDBAccessLocal.getErrorString("", "VTCUSTCD4", "","",conn);
return errString;
}
else if(count == 1)
{
sql1 = "select cust_code from customer where site_code = ? and channel_partner = 'Y'" ;
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1,siteCodeAs);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
custCode = rs1.getString("cust_code");
}
rs1.close();rs1 = null;
pstmt1.close();pstmt1 = null;
}
}
else if(count == 1)
{
sql = "select cust_code from site_customer where site_code__ch = ? and site_code = ? and channel_partner = 'Y'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCodeAs);
pstmt.setString(2,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custCode = checkNull(rs.getString("cust_code"));
}
}
if(rs != null)
{
rs.close();rs = null;
}
if(pstmt != null)
{
pstmt.close();pstmt = null;
}
sql = " select fin_entity from site where site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCodeAs);
rs = pstmt.executeQuery();
if (rs.next())
{
finEntity = checkNull(rs.getString("fin_entity"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
/* sql = " insert into MISC_DRCR_RCP (tran_id,tran_ser,tran_date,eff_date,fin_entity,site_code,sundry_type,sundry_code,acct_code," +
" cctr_code,amount,curr_code,exch_rate,remarks,drcr_flag,tran_id__rcv,confirmed,chg_user,chg_date,chg_term," +
" emp_code__aprv,due_date,tran_type,item_ser,amount__bc,sreturn_no,adj_misc_crn,adj_amount,parent__tran_id,rev__tran," +
" round_adj,cust_ref_no,cust_ref_date,cust_ref_amt,rnd_off,rnd_to,ref_no__cr,wf_status,cust_code__dlv,cust_pord,pord_date," +
" edi_stat,sale_order,add_date,add_user,add_term) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,) ";
*/
/* pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tran_id);
pstmt.setString(2,tran_ser);
pstmt.setTimestamp(3,tran_date);
pstmt.setTimestamp(4,eff_date);
pstmt.setString(5,fin_entity);
pstmt.setString(6,siteCodeAs);
pstmt.setString(7,sundry_type);
pstmt.setString(8,sundry_code);
pstmt.setString(9,acct_code);
pstmt.setString(10,cctr_code);
pstmt.setDouble(11,amount);
pstmt.setString(12,curr_code);
pstmt.setDouble(13,exch_rate);
pstmt.setString(14,remarks);
pstmt.setString(15,drcr_flag);
pstmt.setString(16,tran_id__rcv);
pstmt.setString(17,"N");
pstmt.setString(18,chgUser);
//pstmt.setTimestamp(19,chg_date);
pstmt.setTimestamp(19,currDate);
pstmt.setString(20,chgTerm);
pstmt.setString(21,emp_code__aprv);
pstmt.setTimestamp(22,due_date);
pstmt.setString(23,tran_type);
pstmt.setString(24,item_ser);
pstmt.setDouble(25,amount__bc);
pstmt.setString(26," ");
pstmt.setString(27,adjmisccrn);
pstmt.setDouble(28,adj_amount);
pstmt.setString(29,tranIdAs);
pstmt.setString(30,rev__tran);
pstmt.setDouble(31,0);
pstmt.setString(32,cust_ref_no);
pstmt.setTimestamp(33,cust_ref_date);
pstmt.setDouble(34,cust_ref_amt);
pstmt.setString(35,rnd_off);
pstmt.setDouble(36,rnd_to);
pstmt.setString(37,ref_no__cr);
pstmt.setString(38,wf_status);
pstmt.setString(39,cust_code);
pstmt.setString(40,cust_pord);
pstmt.setTimestamp(41,pord_date);
pstmt.setString(42,edi_stat);
pstmt.setString(43,sale_order);
// pstmt.setTimestamp(44,chg_date);
pstmt.setTimestamp(44,currDate);
pstmt.setString(45,chgUser);
pstmt.setString(46,chgTerm);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
xmlBuff.append("<?xml version='1.0' encoding='ISO-8859-1'?><DocumentRoot>");
xmlBuff.append("<description>Datawindow Root</description>");
xmlBuff.append("<group0>");
xmlBuff.append("<description>Group0 description</description>");
xmlBuff.append("<Header0>");
xmlBuff.append("<objName><![CDATA[").append("misc_drcr_rcp_cr").append("]]></objName>");
xmlBuff.append("<pageContext><![CDATA[").append("1").append("]]></pageContext>");
xmlBuff.append("<objContext><![CDATA[").append("1").append("]]></objContext>");
xmlBuff.append("<editFlag><![CDATA[").append("A").append("]]></editFlag>");
xmlBuff.append("<focusedColumn><![CDATA[").append("").append("]]></focusedColumn>");
xmlBuff.append("<action><![CDATA[").append("SAVE").append("]]></action>");
xmlBuff.append("<elementName><![CDATA[").append("").append("]]></elementName>");
xmlBuff.append("<keyValue><![CDATA[").append("1").append("]]></keyValue>");
xmlBuff.append("<taxKeyValue><![CDATA[").append("").append("]]></taxKeyValue>");
xmlBuff.append("<saveLevel><![CDATA[").append("1").append("]]></saveLevel>");
xmlBuff.append("<forcedSave><![CDATA[").append(true).append("]]></forcedSave>");
xmlBuff.append("<taxInFocus><![CDATA[").append(false).append("]]></taxInFocus>");
xmlBuff.append("<description>Header0 members</description>");
xmlBuff.append("<Detail1 dbID=\"\" domID=\"1\" objContext=\"1\" objName=\"misc_drcr_rcp_cr\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
xmlBuff.append("<misc_drcr_rcp_dr/>");
xmlBuff.append("<tran_id/>");
//xmlBuff.append("<tran_id>").append("<![CDATA[" + tranId + "]]>").append("</tran_id>");
xmlBuff.append("<tran_ser>").append("<![CDATA[" + tranSer + "]]>").append("</tran_ser>");
xmlBuff.append("<tran_date>").append("<![CDATA[" + sdfAppl.format(currDate).toString() + "]]>").append("</tran_date>");
if(effDate !=null)
{
xmlBuff.append("<eff_date>").append("<![CDATA[" + sdfAppl.format(effDate).toString() + "]]>").append("</eff_date>");
}
xmlBuff.append("<fin_entity>").append("<![CDATA[" + finEntity + "]]>").append("</fin_entity>");
xmlBuff.append("<site_code>").append("<![CDATA[" + siteCodeAs + "]]>").append("</site_code>");
xmlBuff.append("<sundry_type>").append("<![CDATA[" + sundryType + "]]>").append("</sundry_type>");
xmlBuff.append("<sundry_code>").append("<![CDATA[" + sundryCode + "]]>").append("</sundry_code>");
xmlBuff.append("<acct_code>").append("<![CDATA[" + acctCode + "]]>").append("</acct_code>");
xmlBuff.append("<cctr_code>").append("<![CDATA[" + cctrCode + "]]>").append("</cctr_code>");
xmlBuff.append("<amount>").append("<![CDATA[" + amount + "]]>").append("</amount>");
xmlBuff.append("<curr_code>").append("<![CDATA[" + currCode + "]]>").append("</curr_code>");
xmlBuff.append("<exch_rate>").append("<![CDATA[" + exchRate + "]]>").append("</exch_rate>");
xmlBuff.append("<remarks>").append("<![CDATA[" + remarks +"]]>").append("</remarks>");
xmlBuff.append("<drcr_flag>").append("<![CDATA[" + drcrFlag + "]]>").append("</drcr_flag>");
xmlBuff.append("<tran_id__rcv>").append("<![CDATA[" + tranIdRcv + "]]>").append("</tran_id__rcv>");
xmlBuff.append("<confirmed>").append("<![CDATA[" + "N" + "]]>").append("</confirmed>");
xmlBuff.append("<chg_user>").append("<![CDATA[" + chgUser + "]]>").append("</chg_user>");
xmlBuff.append("<chg_date>").append("<![CDATA[" + sdfAppl.format(currDate).toString() + "]]>").append("</chg_date>");
xmlBuff.append("<chg_term>").append("<![CDATA[" + chgTerm + "]]>").append("</chg_term>");
xmlBuff.append("<emp_code__aprv>").append("<![CDATA[" + empCodeAprv + "]]>").append("</emp_code__aprv>");
if(dueDate !=null)
{
xmlBuff.append("<due_date>").append("<![CDATA[" + sdfAppl.format(dueDate).toString() + "]]>").append("</due_date>");
}
xmlBuff.append("<tran_type>").append("<![CDATA[" + tranType + "]]>").append("</tran_type>");
xmlBuff.append("<item_ser>").append("<![CDATA[" + itemSer+ "]]>").append("</item_ser>");
xmlBuff.append("<amount__bc>").append("<![CDATA[" +amountBc + "]]>").append("</amount__bc>");
xmlBuff.append("<sreturn_no>").append("<![CDATA[" + " " + "]]>").append("</sreturn_no>");
xmlBuff.append("<ad_misc_crn>").append("<![CDATA[" + adjmisccrn + "]]>").append("</adj_misc_crn>");
xmlBuff.append("<adj_amount>").append("<![CDATA[" + adjAmount + "]]>").append("</adj_amount>");
xmlBuff.append("<parent__tran_id>").append("<![CDATA[" + parentTranId + "]]>").append("</parent__tran_id>");
xmlBuff.append("<rev__tran>").append("<![CDATA[" + revTran + "]]>").append("</rev__tran>");
xmlBuff.append("<round_adj>").append("<![CDATA[" + roundAdj + "]]>").append("</round_adj>");
xmlBuff.append("<cust_ref_no>").append("<![CDATA[" + custRefNo + "]]>").append("</cust_ref_no>");
if(custRefDate !=null)
{
xmlBuff.append("<cust_ref_date>").append("<![CDATA[" + sdfAppl.format(custRefDate).toString() + "]]>").append("</cust_ref_date>");
}
xmlBuff.append("<cust_ref_amt>").append("<![CDATA[" + custRefAmt + "]]>").append("</cust_ref_amt>");
xmlBuff.append("<rnd_off>").append("<![CDATA[" + rndOff + "]]>").append("</rnd_off>");
xmlBuff.append("<rnd_to>").append("<![CDATA[" + rndTo + "]]>").append("</rnd_to>");
xmlBuff.append("<ref_no__cr>").append("<![CDATA[" + refNoCr + "]]>").append("</ref_no__cr>");
xmlBuff.append("<wf_status>").append("<![CDATA[" + wfStatus + "]]>").append("</wf_status>");
xmlBuff.append("<cust_code__dlv>").append("<![CDATA[" + custCodeDlv + "]]>").append("</cust_code__dlv>");
xmlBuff.append("<cust_pord>").append("<![CDATA[" + custPord + "]]>").append("</cust_pord>");
if(pordDate !=null)
{
xmlBuff.append("<pord_date>").append("<![CDATA[" + sdfAppl.format(pordDate).toString() + "]]>").append("</pord_date>");
}
xmlBuff.append("<edi_stat>").append("<![CDATA[" + ediStat + "]]>").append("</edi_stat>");
xmlBuff.append("<sale_order>").append("<![CDATA[" + saleOrder + "]]>").append("</sale_order>");
xmlBuff.append("<add_date>").append("<![CDATA[" + sdfAppl.format(currDate).toString() + "]]>").append("</add_date>");
xmlBuff.append("<add_user>").append("<![CDATA[" + chgUser + "]]>").append("</add_user>");
xmlBuff.append("<add_term>").append("<![CDATA[" + chgTerm + "]]>").append("</add_term>");
xmlBuff.append("</Detail1>");
xmlBuff.append("\n");
sql="select tran_type,tax_date from sreturn where tran_id= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, sreturnNo);
rs=pstmt.executeQuery();
if(rs.next())
{
returnType=rs.getString("tran_type");
taxDate=rs.getTimestamp("tax_date");
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(taxDate == null) //if isnull(ld_tax_date) or string(ld_tax_date,'ddmmyyyy') = '01011900' then ld_tax_date = ld_tran_date
{
taxDate=tranDate;
}
lbFlag=false;
sretunTypeList=distCommon.getDisparams("999999", "SRETURN_TYPE", conn);
if("NULLFOUND".equalsIgnoreCase(sretunTypeList)|| sretunTypeList == null || sretunTypeList.trim().length() ==0 )
{
sretunTypeList="";
}
String sreturn_type[]=sretunTypeList.split(",");
if("NULLFOUND".equalsIgnoreCase(sretunTypeList))
{
sretunTypeList="";
}
if(sreturn_type.length > 0)
{
for (i = 0; i < sreturn_type.length; i++) {
if((returnType.trim()).equalsIgnoreCase(sretunType) )
{
lbFlag=true;
}
}
}
sql="select line_no,acct_code,cctr_code,amount,anal_code,emp_code, " +
" reas_code,tax_amt,net_amt,tax_class,tax_chap,tax_env,ref_no,item_code,quantity,rate," +
"line_no__sret,line_no__invtrace,lot_no,analysis1,analysis2,analysis3,lot_sl,unit" +
" from misc_drcr_rdet " +
" where tran_id = ? and ITEM_CODE is not null";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranIdAs);
rs=pstmt.executeQuery();
while(rs.next())
{
lineNo=rs.getInt("line_no");
acctCode=rs.getString("acct_code");
cctrCode=rs.getString("cctr_code");
amountdet=rs.getDouble("amount");
analCode=rs.getString("anal_code");
empCode=rs.getString("emp_code");
reasCode=rs.getString("reas_code");
taxAmt=rs.getDouble("tax_amt");
netAmt=rs.getDouble("net_amt");
taxClass=rs.getString("tax_class");
taxChap=rs.getString("tax_chap");
taxEnv=rs.getString("tax_env");
refNo=rs.getString("ref_no");
itemCode=rs.getString("item_code");
quantity=rs.getDouble("quantity");
rate=rs.getDouble("rate");
lineNoSret=rs.getInt("line_no__sret");
lineNoInvtrace=rs.getInt("line_no__invtrace");
lotNo=rs.getString("lot_no");
analysis1=rs.getString("analysis1");
analysis2=rs.getString("analysis2");
analysis3=rs.getString("analysis3");
lotSl=rs.getString("lot_sl");
unit=rs.getString("unit");
if( netAmt==0 ) {
netAmt=0;
}
if(amountdet==0)
{
amountdet=0;
netAmt=netAmt-taxAmt;
}
if(lbFlag)
{
taxEnvSr=(finCommon.getFinparams("999999","SRETURN_TAX_ENV",conn));
if("NULLFOUND".equalsIgnoreCase(taxEnvSr) || taxEnvSr == null || taxEnvSr.trim().length() ==0 )
{
taxEnvSr="";
}
}
else
{
taxEnvSr=taxEnv;
}
/* sql="insert into misc_drcr_rdet (tran_id,line_no,acct_code,cctr_code,amount,anal_code,emp_code, " +
" reas_code,tax_amt,net_amt,tax_class,tax_chap,tax_env,ref_no,item_code,quantity, " +
" rate,line_no__sret,line_no__invtrace,lot_no,analysis1,analysis2,analysis3,lot_sl,unit) " +
" Values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";*/
/*pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tran_id);
pstmt.setInt(2, line_no);
pstmt.setString(3, acct_code);
pstmt.setString(4, cctr_code);
pstmt.setDouble(5, amountdet);
pstmt.setString(6, anal_code);
pstmt.setString(7, emp_code);
pstmt.setString(8, reas_code);
pstmt.setDouble(9, tax_amt);
pstmt.setDouble(10, net_amt);
pstmt.setString(11, tax_class);
pstmt.setString(12, tax_chap);
pstmt.setString(13, tax_env_sr);
pstmt.setString(14, ref_no);
pstmt.setString(15, item_code);
pstmt.setDouble(16, quantity);
pstmt.setDouble(17, rate);
pstmt.setInt(18, line_no__sret);
pstmt.setInt(19, line_no__invtrace);
pstmt.setString(20, lot_no);
pstmt.setString(21, analysis1);
pstmt.setString(22, analysis2);
pstmt.setString(23, analysis3);
pstmt.setString(24, lot_sl);
pstmt.setString(25, unit);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
xmlBuff.append("<Detail2 dbID=\"\" domID=\""+lineNo+"\" objContext=\"2\" objName=\"misc_drcr_rcp_cr\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>");
xmlBuff.append("<misc_drcr_rcp_dr/>");
//xmlBuff.append("<line_no><![CDATA["+ ll_line_no+"]]></line_no>");
//xmlBuff.append("<tran_id>").append("<![CDATA[" + tranId + "]]>").append("</tran_id>");
xmlBuff.append("<line_no>").append("<![CDATA[" + lineNo + "]]>").append("</line_no>");
xmlBuff.append("<acct_code>").append("<![CDATA[" + acctCode + "]]>").append("</acct_code>");
xmlBuff.append("<cctr_code>").append("<![CDATA[" + cctrCode + "]]>").append("</cctr_code>");
xmlBuff.append("<amount>").append("<![CDATA[" + amount + "]]>").append("</amount>");
xmlBuff.append("<anal_code>").append("<![CDATA[" + analCode + "]]>").append("</anal_code>");
xmlBuff.append("<emp_code>").append("<![CDATA[" + empCode + "]]>").append("</emp_code>");
xmlBuff.append("<reas_code>").append("<![CDATA[" + reasCode + "]]>").append("</reas_code>");
xmlBuff.append("<tax_amt>").append("<![CDATA[" + taxAmt + "]]>").append("</tax_amt>");
xmlBuff.append("<net_amt>").append("<![CDATA[" + netAmt + "]]>").append("</net_amt>");
xmlBuff.append("<tax_class><![CDATA["+ taxClass +"]]></tax_class>");
xmlBuff.append("<tax_chap><![CDATA["+ taxChap +"]]></tax_chap>");
xmlBuff.append("<tax_env><![CDATA["+ taxEnvSr +"]]></tax_env>");
xmlBuff.append("<ref_no><![CDATA["+ refNo +"]]></ref_no>");
xmlBuff.append("<item_code>").append("<![CDATA[" + itemCode + "]]>").append("</item_code>");
xmlBuff.append("<quantity>").append("<![CDATA[" + quantity + "]]>").append("</quantity>");
xmlBuff.append("<rate>").append("<![CDATA[" + rate+ "]]>").append("</rate>");
xmlBuff.append("<line_no__sret>").append("<![CDATA[" + lineNoSret + "]]>").append("</line_no__sret>");
xmlBuff.append("<line_no__invtrace>").append("<![CDATA[" + lineNoInvtrace + "]]>").append("</line_no__invtrace>");
xmlBuff.append("<lot_no>").append("<![CDATA[" + lotNo + "]]>").append("</lot_no>");
xmlBuff.append("<analysis1><![CDATA["+ analysis1 +"]]></analysis1>");
xmlBuff.append("<analysis2><![CDATA["+ analysis2 +"]]></analysis2>");
xmlBuff.append("<analysis3><![CDATA["+ analysis3 +"]]></analysis3>");
xmlBuff.append("<lot_sl>").append("<![CDATA[" + lotSl + "]]>").append("</lot_sl>");
xmlBuff.append("<unit>").append("<![CDATA[" + unit + "]]>").append("</unit>");
xmlBuff.append("</Detail2>");
xmlBuff.append("\n");
/*if(taxEnvSr.trim().length()>0 && taxEnvSr!=null)
{
if(lbFlag=true)
{
lds_drcr_rcp_det.retrieve(ls_tran_id_new , ll_line_no)
ds_tax_detbrow.reset()
//lc_tax_amtdet = gf_calc_tax_ds(lds_drcr_rcp_det,ds_tax_detbrow,transer,ls_tran_id_new,ld_tax_date,"rate", "quantity",0,ls_curr_code,'2')
}
else
{
ds_salesreturn_retnline.retrieve(ls_sreturn_no , ll_line_no__sret)
ds_salesreturn_retnline.setitem(1,'line_no',ll_line_no)
ds_tax_detbrow.reset()
lc_tax_amtdet = gf_calc_tax_ds(ds_salesreturn_retnline,ds_tax_detbrow,transer,ls_tran_id_new,ld_tax_date,"rate__stduom", "quantity__stduom",0,ls_curr_code,'2')
}
}*/
/*if(taxAmtdet==0 ) // if isnull(lc_tax_amtdet) or lc_tax_amtdet = -999999999 then lc_tax_amtdet = 0
{
taxAmtdet=0;
}
if(netAmt==0)
{
netAmt=0;
}
if(totNetAmt==0)
{
totNetAmt=0;
}
if(tottax==0)
{
tottax=0;
}
if(totdiscamt==0)
{
totdiscamt=0;
}
totNetAmt=totNetAmt+netAmt+taxAmtdet;
sql=" update misc_drcr_rdet" +
" set tax_amt = ?," +
" net_amt = (net_amt + (? - ?))" +
" where tran_id = ? " +
" and line_no = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1,taxAmtdet);
pstmt.setDouble(2,taxAmtdet);
pstmt.setDouble(3,discount);
pstmt.setString(4,tranIdNew);
pstmt.setInt(5, lineNo);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;*/
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
/*fetch c_misc_drcr_rcpdet into :ll_line_no,:ls_acct_code,:ls_cctr_code,:lc_amountdet,:ls_anal_code,:ls_emp_code,
:ls_reas_code,:lc_tax_amt,:lc_net_amt,:ls_tax_class,:ls_tax_chap,:ls_tax_env,:ls_ref_no,:ls_item_code,:lc_quantity,
:lc_rate,:ll_line_no__sret,:ll_line_no__invtrace,:ls_lot_no,:ls_analysis1,:ls_analysis2,:ls_analysis3,:ls_lot_sl,:ls_unit;*/
sql="select line_no,ref_ser,ref_no,ref_bal_amt,adj_amt,mrp_value__adj "+
" from misc_drcr_rcpinv where tran_id= ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, tranIdAs);
rs=pstmt.executeQuery();
while(rs.next())
{
lineNoRcpinv=rs.getInt("line_no");
refSerRcpinv=rs.getString("ref_ser");
refNoRcpinv=rs.getString("ref_no");
refBalAmtRcpinv=rs.getDouble("ref_bal_amt");
adjAmtRcpinv=rs.getDouble("adj_amt");
mrpValueAdjRcpinv=rs.getDouble("mrp_value__adj");
/*
sql="insert into misc_drcr_rcpinv (tran_id, line_no,ref_ser,ref_no,ref_bal_amt,adj_amt,mrp_value__adj) "+
" Values (?,?,?,?,?,?,?) ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranIdNew);
pstmt.setInt(2, lineNoRcpinv);
pstmt.setString(3, refSerRcpinv);
pstmt.setString(4, refNoRcpinv);
pstmt.setDouble(5, refBalAmtRcpinv);
pstmt.setDouble(6, adjAmtRcpinv);
pstmt.setDouble(7, mrpValueAdjRcpinv);
pstmt.executeUpdate();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}*/
xmlBuff.append("<Detail3 dbID=\"\" domID=\""+lineNoRcpinv+"\" objContext=\"3\" objName=\"misc_drcr_rcp_cr\">");
xmlBuff.append("<line_no><![CDATA["+ lineNoRcpinv +"]]></line_no>");
xmlBuff.append("<ref_ser><![CDATA["+ refSerRcpinv +"]]></ref_ser>");
xmlBuff.append("<ref_no><![CDATA["+ refNoRcpinv +"]]></ref_no>");
xmlBuff.append("<ref_bal_amt><![CDATA["+ refBalAmtRcpinv +"]]></ref_bal_amt>");
xmlBuff.append("<adj_amt><![CDATA["+ adjAmtRcpinv +"]]></adj_amt>");
xmlBuff.append("<mrp_val__adj><![CDATA["+ mrpValueAdjRcpinv +"]]></mrp_val__adj>");
xmlBuff.append("</Detail3>");
//fetch c_misc_drcr_rcpinv into :ll_line_no_rcpinv,:ls_ref_ser_rcpinv,:ls_ref_no_rcpinv,:lc_ref_bal_amt_rcpinv,:lc_adj_amt_rcpinv,:lc_mrp_value__adj_rcpinv ;
/*sql="update misc_drcr_rcp " +
" set AMOUNT = ?, " +
" AMOUNT__BC = ? " +
" where tran_id = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1,totNetAmt);
pstmt.setDouble(2,totNetAmt);
pstmt.setString(3,tranIdNew);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;*/
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>");
String xmlString = xmlBuff.toString().trim().replaceFirst("^([\\W]+)<","<");
String drNtTranId="";
// errString = saveData(xtraParams,siteCodeAs,xmlString,conn);
errString = saveData(xtraParams,siteCodeAs,xmlBuff.toString(),conn);
//System.out.println("@@@@@2: retString:"+errorString);
//System.out.println("--retString finished--");
if (errString.indexOf("Success") > -1)
{
System.out.println("@@@@@@3: Success"+errString);
Document dom = genericUtility.parseString(errString);
//System.out.println("dom>>>"+dom);
tranIdNew = genericUtility.getColumnValue("TranID",dom);
}
else
{
//System.out.println("[SuccessSuccess" + errorString + "]");
conn.rollback();
return errString;
}
//errString = nvo_misc.gbf_retrieve_misc_drcr_rcp(ls_tran_id_new, ls_tran_id_new,1,siteCodeAs);
DrCrRcpConf drcrObj = new DrCrRcpConf();
errString = drcrObj.confirm (tranIdNew, xtraParams, "" , conn);
//System.out.println("After DrCrRcpConf---->["+errorString+"]");
if(errString != null && errString.indexOf("VTCICONF3") != -1)
{
errString = "";
}
if(errString.trim().length()==0)
{
sql=" update sreturn "+
" set tran_id__crn = ? "+
" where tran_id = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranIdAs);
pstmt.setString(2,sreturnNo);
pstmt.executeUpdate();
pstmt.close();
pstmt=null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return errString;
} //end manish
private String generateTranId(String windowName, String siteCode,String ls_drcr_flag, String tranDateStr, Connection conn) throws ITMException
{
PreparedStatement pstmt = null;
......
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