Commit 97b4e65b authored by manohar's avatar manohar

changes to consider creqte voucher


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91502 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b2a42c75
......@@ -20,6 +20,10 @@ import ibase.webitm.ejb.sys.UtilMethods;
public class CreatePoRcpVoucher
{
GenericUtility genericUtility = GenericUtility.getInstance();
FinCommon finCommon = new FinCommon();
DistCommon distCommon = new DistCommon();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String createPoRcpVoucher(String tranId,String xtraParams, Connection conn) throws ITMException
{
////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -59,26 +63,28 @@ public class CreatePoRcpVoucher
PreparedStatement pstmt = null, pstmt1 = null, pstmtUpd = null;
ResultSet rs = null, rs1 = null;
java.sql.Timestamp today = null, chgDate = null, tranDate = null, effectiveDate = null, taxDate = null;
java.sql.Timestamp invoiceDate = null, DcDate = null, receiptDate = null, hdrRcpDate = null, dueDate = null;
java.sql.Timestamp tranDate = null, effectiveDate = null, taxDate = null, dueDate = null;
java.sql.Timestamp today = null, invoiceDate = null, DcDate = null, receiptDate = null, hdrRcpDate = null;
String errCode = "", errString = "", winName = "", roundString = "",roundOff = "", confFinVar = "N", autoConfirm = "N";
double diffTotal = 0, advTotal = 0, amount = 0, discount = 0, taxAmt = 0, exchRate = 0, suppBillAmount = 0;
int roundTo = 0, lineCount = 0;
double diffTotal = 0, advTotal = 0, amount = 0, discount = 0, taxAmt = 0, exchRate = 0, suppBillAmount = 0, rcpTaxNP = 0;
int roundTo = 0, lineCount = 0, count = 0, ctr = 0;
String tranType = "", purcOrder = "", suppCode = "", tranCode = "", currCode = "", tranSer = "";
String tranType = "", purcOrder = "", suppCode = "", tranCode = "", currCode = "", tranSer = "", taxClass = "", taxEnv = "", taxChap = "";
String remarks = "", siteCode = "", invoiceNo = "", DcNo = "", retOpt = "", postType = "", itemSer = "";
String invOnLine = "", poRcpOnLine = "", postProv = "", crTerm = "", projCode = "", pordType = "";
String analCode = "", bankCodePay = "", acctCodePur = "", cctrCodePur = "", payMode = "", profileId = "";
String finEntity = "", bankCode = "", keyString = "", ledgPostConf = "",whetherToConvert = "N", userId = "SYSTEM";
String finEntity = "", bankCode = "", keyString = "", ledgPostConf = "",whetherToConvert = "N", userId = "SYSTEM", termId = "SYSTEM";
java.text.SimpleDateFormat sdf = null;
String acctCodeCF = "", acctCodeCFAP = "", cctrCodeCF = "", cctrCodeCFAP = "", suppCodePay = "";
String rcpLine = "", purcOrderDet = "", lineNoOrd = "", rcpItemCode = "", rcpUnit = "";
String acctCodeDR = "", cctrCodeDR = "", deptCode = "", acctCodeCR = "", cctrCodeCR = "";
String acctCodeProvDR = "", cctrCodeProvDR = "", acctCodeProvCR = "", cctrCodeProvCR = "";
double rcpQuantity = 0, rcpRate = 0, rcpDiscount = 0, rcpTaxAmount = 0, rcpNetAmount = 0, rcpQtyStd = 0;
double rcpRateStd = 0,purcRate = 0, purcDisc = 0, rateDiscount[];
String acctCodePH = "", ccrtCodePH = "", taxVar = "", acctCodePPV = "", cctrCodePPV = "", returnId = "";
double rcpDiscAmt = = 0, rcpAmount = 0, vouchQuantity = 0, vouchAmount = 0, taxMultiplier = 1;
double rcpRateStd = 0,purcRate = 0, purcDisc = 0, rateDiscount[] = {0,0}, netAmount = 0, netAmountBase = 0, rateClg = 0, stdRate = 0;
String acctCodePH = "", ccrtCodePH = "", taxVar = "", acctCodePPV = "", cctrCodePPV = "", returnId = "", sql = "";
double rcpDiscAmt = 0, rcpAmount = 0, vouchQuantity = 0, vouchAmount = 0, taxMultiplier = 1, totAmount = 0, purcRateStd = 0;
String chgDate = null, acctCodeAP = "", ccrtCodeAP = "", msgType = "", taxVar1 = "", taxVar2 = "";
try
{
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
......@@ -98,23 +104,23 @@ public class CreatePoRcpVoucher
today = new java.sql.Timestamp(System.currentTimeMillis());
sdf = new java.text.SimpleDateFormat(genericUtility.getDBDateTimeFormat());
chgDate = sdf.parse(today.toString());
winName = 'w_voucher';
//chgDate = sdf.parse(today.toString());
winName = "w_voucher";
diffTotal = 0;
advTotal = 0;
roundString = "VOUCH-RND";
roundOff = finCommon.getFinparams("999999", roundString);
roundOff = finCommon.getFinparams("999999", roundString, conn);
if (!"NULLFOUND".equals(roundOff))
{
roundString = "VOUCH-RNDTO";
roundString = finCommon.getFinparams("999999", roundString);
roundString = finCommon.getFinparams("999999", roundString, conn);
}
if (!"NULLFOUND".equals(roundString))
{
roundTo = Integer.parseInt(roundString);
}
// added by deepali 18/03/04
confFinVar = finCommon.getFinparams("999999", "AUTO_CONF_VOUCH");
confFinVar = finCommon.getFinparams("999999", "AUTO_CONF_VOUCH", conn);
if (!"NULLFOUND".equals(confFinVar))
{
if ("Y".equals(confFinVar))
......@@ -216,18 +222,18 @@ public class CreatePoRcpVoucher
// shiri 09/05/02 moved sql from down, as ls_type is required first
// In below select statement, bank_code__pay added by fatema-31/01/2008-FI78SUN034
sql = "SELECT CR_TERM, PROJ_CODE, PORD_TYPE, ANAL_CODE, BANK_CODE__PAY "
+ " FROM PORDER WHERE PURC_ORDER = ? " //
+ " FROM PORDER WHERE PURC_ORDER = ? " ;//
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,purcOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
crTerm = rs.geString("CR_TERM");
projCode = rs.geString("PROJ_CODE");
pordType = rs.geString("PORD_TYPE");
analCode = rs.geString("ANAL_CODE");
bankCodePay = rs.geString("BANK_CODE__PAY");
crTerm = rs.getString("CR_TERM");
projCode = rs.getString("PROJ_CODE");
pordType = rs.getString("PORD_TYPE");
analCode = rs.getString("ANAL_CODE");
bankCodePay = rs.getString("BANK_CODE__PAY");
}
hdrRcpDate = tranDate;
// added by shiri 20/12/01 as tax should not contain the non_payable = 'Y'
......@@ -488,26 +494,26 @@ public class CreatePoRcpVoucher
pstmt.close();
pstmt = null;
// if the posting is on conf. date then set tran date to today
if "Y".equals(ledgPostConf)
if ("Y".equals(ledgPostConf) )
{
sdf = new java.text.SimpleDateFormat(genericUtility.getDBDateFormat());
tranDate = sdf.parse(today.toString());
tranDate = java.sql.Timestamp.valueOf( sdf.parse(today.toString()) + " 00:00:00.0") ;
}
//Updating voucher header
if ("P-RET".equals(tranSer)
if ("P-RET".equals(tranSer))
{
amount = 0 - amount;
taxAmt = 0 - taxAmt;
discount = 0 - discount;
ld_duedate = tranDate;
dueDate = tranDate;
}
else
{
//Due date = rec_date + crdays iff start_from is receipt in crterm master,
//for this Commented & added jasmina 09/04/09-FI89SUN026
//ld_duedate = gbf_calc_duedate(crTerm, receiptDate, effectiveDate, invoiceDate)
//dueDate = gbf_calc_duedate(crTerm, receiptDate, effectiveDate, invoiceDate)
if (receiptDate == null)
{
receiptDate = hdrRcpDate;
......@@ -534,7 +540,7 @@ public class CreatePoRcpVoucher
//added by jyoti 20/9/04.
//If 'Y' only then the DC_NO will be set
whetherToConvert = distCommon.getDisparams("999999","INV_TO_DC",conn);
if (".equals(whetherToConvert))
if ("NULLFOUND".equals(whetherToConvert))
{
whetherToConvert = "N";
}
......@@ -785,8 +791,8 @@ public class CreatePoRcpVoucher
xmlBuff.append("<diff_amt__exch><![CDATA[0]]></diff_amt__exch>");
xmlBuff.append("<supp_bill_amt><![CDATA[" + suppBillAmount + "]]></supp_bill_amt>");
xmlBuff.append("<chg_user><![CDATA[" + userid + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termid + "]]></chg_term>");
xmlBuff.append("<chg_user><![CDATA[" + userId + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termId + "]]></chg_term>");
sdf = new java.text.SimpleDateFormat(genericUtility.getApplDateTimeFormat());
xmlBuff.append("<chg_date><![CDATA[" + sdf.parse(today.toString()) + "]]></chg_date>");
......@@ -850,7 +856,7 @@ public class CreatePoRcpVoucher
+ " where a.tax_code = b.tax_code "
+ " and a.tran_code = ? "
+ " and a.tran_id = ? "
+ " and a.line_no = ? ";
+ " and a.line_no = ? "
+ " and (case when b.non_payable is null then 'N' else b.non_payable end) <> 'Y' "
+ " and b.effect <> 'N'";
pstmt1 = conn.prepareStatement(sql);
......@@ -867,7 +873,7 @@ public class CreatePoRcpVoucher
pstmt1.close();
pstmt1 = null;
taxVar1 = rcpTaxAmount; //amit-13/08/02
//******************taxVar1 = rcpTaxAmount; //amit-13/08/02
// to get the tax with non_payable = 'Y' as to subtract from the net amt
//Converted nvl to case by Archiman 12/08/08
// Commented select nvl(sum(nvl(a.tax_amt,0)),0) into :rcpTaxNP by Archiman
......@@ -878,7 +884,7 @@ public class CreatePoRcpVoucher
+ " where a.tax_code = b.tax_code "
+ " and a.tran_code = ? "
+ " and a.tran_id = ? "
+ " and a.line_no = ? ";
+ " and a.line_no = ? "
+ " and (case when b.non_payable is null then 'N' else b.non_payable end) = 'Y' ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, tranSer);
......@@ -1051,10 +1057,10 @@ public class CreatePoRcpVoucher
rs1 = null;
pstmt1.close();
pstmt1 = null;
ls_cctr_diff = finCommon.getAcctDetrTtype(rcpItemCode, itemSer, "PPV", pordType, conn);
if (ls_cctr_diff != null && ls_cctr_diff.trim().length() > 0)
cctrCodePPV = finCommon.getAcctDetrTtype(rcpItemCode, itemSer, "PPV", pordType, conn);
if (cctrCodePPV != null && cctrCodePPV.trim().length() > 0)
{
acctCodePPV = ls_cctr_diff.substring(0,ls_cctr_diff.indexOf(","));
acctCodePPV = cctrCodePPV.substring(0,cctrCodePPV.indexOf(","));
cctrCodePPV = cctrCodePPV.substring(cctrCodePPV.indexOf(",")+1);
}
}
......@@ -1132,8 +1138,8 @@ public class CreatePoRcpVoucher
//rcpNetAmount = rcpNetAmount + rcpTaxAmount - taxVar1 //amit-13/08/02
rcpNetAmount = rcpAmount + rcpTaxAmount
*/
if len(trim(cctrCodePPV)) = 0 then setnull(cctrCodePPV)//added by zahid 10/06/04
if len(trim(acctCodePPV)) = 0 then setnull(acctCodePPV)//added by zahid 10/06/04
//if (cctrCodePPV == null || setnull(cctrCodePPV)//added by zahid 10/06/04
//if len(trim(acctCodePPV)) = 0 then setnull(acctCodePPV)//added by zahid 10/06/04
// 1 Added by Vilas as on 14-03-02
ctr++;
......@@ -1162,9 +1168,10 @@ public class CreatePoRcpVoucher
xmlBuff.append("<tax_amt><![CDATA[" + rcpTaxAmount + "]]></tax_amt>");
xmlBuff.append("<net_amt><![CDATA[" + rcpNetAmount + "]]></net_amt>");
xmlBuff.append("<post_diff><![CDATA[I]]></post_diff>");
xmlBuff.append("<chg_date><![CDATA[" + chgDate + "]]></chg_date>");
xmlBuff.append("<chg_user><![CDATA[" + userid + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termid + "]]></chg_term>");
sdf = new java.text.SimpleDateFormat(genericUtility.getDBDateTimeFormat());
xmlBuff.append("<chg_date><![CDATA[" + sdf.parse(today.toString()) + "]]></chg_date>");
xmlBuff.append("<chg_user><![CDATA[" + userId + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termId + "]]></chg_term>");
xmlBuff.append("<item_ser><![CDATA[" + itemSer + "]]></item_ser>");
xmlBuff.append("<vouch_qty__stduom><![CDATA[" + rcpQtyStd + "]]></vouch_qty__stduom>");
xmlBuff.append("<vouch_rate__stduom><![CDATA[" + rcpRateStd + "]]></vouch_rate__stduom>");
......@@ -1476,8 +1483,8 @@ public class CreatePoRcpVoucher
xmlBuff.append("<net_amt><![CDATA[" + rcpNetAmount + "]]></net_amt>");
xmlBuff.append("<post_diff><![CDATA[I]]></post_diff>");
xmlBuff.append("<chg_date><![CDATA[" + chgDate + "]]></chg_date>");
xmlBuff.append("<chg_user><![CDATA[" + userid + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termid + "]]></chg_term>");
xmlBuff.append("<chg_user><![CDATA[" + userId + "]]></chg_user>");
xmlBuff.append("<chg_term><![CDATA[" + termId + "]]></chg_term>");
xmlBuff.append("<item_ser><![CDATA[" + itemSer + "]]></item_ser>");
xmlBuff.append("<vouch_qty__stduom><![CDATA[" + rcpQtyStd + "]]></vouch_qty__stduom>");
xmlBuff.append("<vouch_rate__stduom><![CDATA[" + rcpRateStd + "]]></vouch_rate__stduom>");
......@@ -1881,15 +1888,15 @@ public class CreatePoRcpVoucher
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String porderNo "", provNo "";
double rateDiscount[];
String porderNo = "", provNo = "";
double rateDiscount[] = {0,0};
try
{
sql = " select purc_order, (case when provi_tran_id is null then '' else provi_tran_id end) as provi_tran_id"
+ " from porder where purc_order = ?"; //: ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,as_pord);
pstmt.setString(1,purcOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1991,7 +1998,7 @@ public class CreatePoRcpVoucher
checkNetAmountBC = netAmount * exchRate; // Added by fatema - 03/01/2007
//In below if stateme,In 3 condn,Replaced round((netAmount * exchRate),3)
//with checkNetAmountBC by fatema-03/01/2007 to avoid decimal difference error - Req FI6CHT0034
if (billAmount + taxAmount != totAmount || totAmount + advAmount != netAmount || checkNetAmountBC != netAmountBC || isnull(totAmount) )
if (billAmount + taxAmount != totAmount || totAmount + advAmount != netAmount || checkNetAmountBC != netAmountBC || totAmount == 0 )
{
errCode = "VTVOUCAMT";
return errCode;
......@@ -2043,7 +2050,6 @@ public class CreatePoRcpVoucher
}
// Ashok on 7/1/03 to get the variance defined in the variable
DistCommon distCommon = new DistCommon();
varValue = distCommon.getDisparams("999999","RCP_UOM_VARIANCE",conn);
if ("NULLFOUND".equals(varValue))
......
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