Commit fc0c27ee authored by manohar's avatar manohar

Various bug fixing related to CHT specific commission customisation done


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97106 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1d383ccc
...@@ -480,6 +480,7 @@ public class CalculateCommission ...@@ -480,6 +480,7 @@ public class CalculateCommission
HashMap commMap = new HashMap(); HashMap commMap = new HashMap();
ArrayList commtList = new ArrayList(); ArrayList commtList = new ArrayList();
ArrayList<String> drnList = null; ArrayList<String> drnList = null;
ArrayList<String> tranIdList = null;
try try
{ {
genericUtility = new GenericUtility(); genericUtility = new GenericUtility();
...@@ -1178,14 +1179,17 @@ public class CalculateCommission ...@@ -1178,14 +1179,17 @@ public class CalculateCommission
} }
} }
else
{
remarks = "Agst Sales Return No"+ sretId+"";
}
if (crntExchrate == 0 ) if (crntExchrate == 0 )
{ {
crntExchrate = 1; crntExchrate = 1;
} }
}
else
{
remarks = "Agst Sales Return No"+ sretId+"";
}
xmlBuff.append("<exch_rate><![CDATA["+ crntExchrate +"]]></exch_rate>"); xmlBuff.append("<exch_rate><![CDATA["+ crntExchrate +"]]></exch_rate>");
if ("SR".equalsIgnoreCase(calledFrom) || "P".equalsIgnoreCase(calledFrom)) if ("SR".equalsIgnoreCase(calledFrom) || "P".equalsIgnoreCase(calledFrom))
{ {
...@@ -1227,28 +1231,17 @@ public class CalculateCommission ...@@ -1227,28 +1231,17 @@ public class CalculateCommission
xmlBuff.append("<tran_id__rcv><![CDATA["+ tranIdRcp +"]]></tran_id__rcv>"); xmlBuff.append("<tran_id__rcv><![CDATA["+ tranIdRcp +"]]></tran_id__rcv>");
} }
xmlBuff.append("<amount><![CDATA[0]]></amount>");
xmlBuff.append("<amount__bc><![CDATA[0]]></amount__bc>");
xmlBuff.append("<round_adj><![CDATA[0]]></round_adj>");
xmlBuff.append("<diff_amt_exch><![CDATA[0]]></diff_amt_exch>");
xmlBuff.append("</Detail1>"); xmlBuff.append("</Detail1>");
}
if(errString == null || errString.trim().length() ==0) if(errString == null || errString.trim().length() ==0)
{ {
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"drcrinv\" objContext=\"2\">"); //sorder modify to sorder_insert by kunal
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<tran_id/>");
xmlBuff.append("<line_no><![CDATA["+ lineNo +"]]></line_no>");
xmlBuff.append("<invoice_id><![CDATA["+ invoiceId +"]]></invoice_id>");
xmlBuff.append("<line_no__inv><![CDATA["+ lineNoInv +"]]></line_no__inv>");
xmlBuff.append("<item_code><![CDATA["+ itemCode +"]]></item_code>");
xmlBuff.append("<tax_class><![CDATA["+ taxClass +"]]></tax_class>");
xmlBuff.append("<tax_chap><![CDATA["+ taxChap +"]]></tax_chap>");
xmlBuff.append("<tax_env><![CDATA["+ taxEnv +"]]></tax_env>");
xmlBuff.append("<acct_code><![CDATA["+ acctcodeExp +"]]></acct_code>");
xmlBuff.append("<cctr_code><![CDATA["+ cctrcodeExp +"]]></cctr_code>");
if (jvExchrate == 0 ) if (jvExchrate == 0 )
{ {
jvExchrate = 1; jvExchrate = 1;
} }
xmlBuff.append("<exch_rate__inv><![CDATA["+ jvExchrate +"]]></exch_rate__inv>");
xmlBuff.append("</Detail2>");
if(lineNoInv == 0) if(lineNoInv == 0)
{ {
invLineNo = lineNoInv; invLineNo = lineNoInv;
...@@ -1295,6 +1288,8 @@ public class CalculateCommission ...@@ -1295,6 +1288,8 @@ public class CalculateCommission
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
System.out.println("08/01/15 manoharan netAmt before ["+netAmt + "]");
if("SR".equalsIgnoreCase(calledFrom) && "P".equalsIgnoreCase(commCalc)) if("SR".equalsIgnoreCase(calledFrom) && "P".equalsIgnoreCase(commCalc))
{ {
if(invNetamt > 0) if(invNetamt > 0)
...@@ -1310,10 +1305,29 @@ public class CalculateCommission ...@@ -1310,10 +1305,29 @@ public class CalculateCommission
netAmt = netAmt * sretPerc / 100; netAmt = netAmt * sretPerc / 100;
} }
} }
System.out.println("08/01/15 manoharan netAmt before ["+netAmt + "]");
drcrAmt = netAmt; drcrAmt = netAmt;
if (drcrAmt != 0)
{
lineNo++;
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"drcrinv\" objContext=\"2\">"); //sorder modify to sorder_insert by kunal
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<tran_id/>");
xmlBuff.append("<line_no><![CDATA["+ lineNo +"]]></line_no>");
xmlBuff.append("<invoice_id><![CDATA["+ invoiceId +"]]></invoice_id>");
xmlBuff.append("<line_no__inv><![CDATA["+ lineNoInv +"]]></line_no__inv>");
xmlBuff.append("<item_code><![CDATA["+ itemCode +"]]></item_code>");
xmlBuff.append("<tax_class><![CDATA["+ taxClass +"]]></tax_class>");
xmlBuff.append("<tax_chap><![CDATA["+ taxChap +"]]></tax_chap>");
xmlBuff.append("<tax_env><![CDATA["+ taxEnv +"]]></tax_env>");
xmlBuff.append("<acct_code><![CDATA["+ acctcodeExp +"]]></acct_code>");
xmlBuff.append("<cctr_code><![CDATA["+ cctrcodeExp +"]]></cctr_code>");
xmlBuff.append("<exch_rate__inv><![CDATA["+ jvExchrate +"]]></exch_rate__inv>");
xmlBuff.append("<drcr_amt><![CDATA["+ drcrAmt +"]]></drcr_amt>"); xmlBuff.append("<drcr_amt><![CDATA["+ drcrAmt +"]]></drcr_amt>");
xmlBuff.append("<tax_amt><![CDATA[0]]></tax_amt>");
xmlBuff.append("<net_amt><![CDATA["+ drcrAmt +"]]></net_amt>");
xmlBuff.append("</Detail2>");
}
oldsp = salesPers; oldsp = salesPers;
currcdSpOld = currcodeSp ; currcdSpOld = currcodeSp ;
...@@ -1333,21 +1347,20 @@ public class CalculateCommission ...@@ -1333,21 +1347,20 @@ public class CalculateCommission
System.out.println("1................ dueDate ["+dueDate + "] date [" + date + "]"); System.out.println("1................ dueDate ["+dueDate + "] date [" + date + "]");
day = utilMethods.DaysAfter(dueDate, date); day = utilMethods.DaysAfter(dueDate, date);
System.out.println("08/01/15 manoharan drcrmt before ["+drcrmt + "]");
if(day >0 ) if(day > 0 && drcrmt != 0 )
{ {
sql = "select fin_chg,fchg_type from crtermfc " + sql = "select fin_chg,fchg_type from crtermfc " +
"where (min_day <= ? and max_day >= ? ) and cr_term = ? "; "where (min_day <= ? and max_day >= ? ) and cr_term = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm); pstmt.setLong(1, day);
pstmt.setLong(2, day);
pstmt.setString(3, crTerm);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
finChg = rs.getDouble(1); finChg = rs.getDouble(1);
fchgType = rs.getString(1); fchgType = rs.getString(1);
}
else
{
if("P".equalsIgnoreCase(fchgType)) if("P".equalsIgnoreCase(fchgType))
{ {
expAmt = drcrmt * (finChg/100); expAmt = drcrmt * (finChg/100);
...@@ -1358,6 +1371,11 @@ public class CalculateCommission ...@@ -1358,6 +1371,11 @@ public class CalculateCommission
expAmt = finChg/100; expAmt = finChg/100;
drcrmt = drcrmt - finChg; drcrmt = drcrmt - finChg;
} }
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//xmlBuff.append("<amount><![CDATA["+ totNetAmt +"]]></amount>"); //xmlBuff.append("<amount><![CDATA["+ totNetAmt +"]]></amount>");
//xmlBuff.append("<amount__bc><![CDATA["+ (totNetAmt-expAmt) +"]]></amount__bc>"); //xmlBuff.append("<amount__bc><![CDATA["+ (totNetAmt-expAmt) +"]]></amount__bc>");
...@@ -1374,20 +1392,14 @@ public class CalculateCommission ...@@ -1374,20 +1392,14 @@ public class CalculateCommission
{ {
cctrcodeDeduct = cctrcodeExp; cctrcodeDeduct = cctrcodeExp;
} }
} }
} if (expAmt != 0 )
rs.close(); {
rs = null; lineNo++;
pstmt.close();
pstmt = null;
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"drcrinv\" objContext=\"2\">"); xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"drcrinv\" objContext=\"2\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />"); xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<tran_id/>"); xmlBuff.append("<tran_id/>");
xmlBuff.append("<line_no><![CDATA["+ lineNo++ +"]]></line_no>"); xmlBuff.append("<line_no><![CDATA["+ lineNo +"]]></line_no>");
xmlBuff.append("<invoice_id><![CDATA["+ invoiceId +"]]></invoice_id>"); xmlBuff.append("<invoice_id><![CDATA["+ invoiceId +"]]></invoice_id>");
xmlBuff.append("<line_no__inv><![CDATA["+ lineNoInv +"]]></line_no__inv>"); xmlBuff.append("<line_no__inv><![CDATA["+ lineNoInv +"]]></line_no__inv>");
xmlBuff.append("<item_code><![CDATA["+ itemCode +"]]></item_code>"); xmlBuff.append("<item_code><![CDATA["+ itemCode +"]]></item_code>");
...@@ -1396,6 +1408,7 @@ public class CalculateCommission ...@@ -1396,6 +1408,7 @@ public class CalculateCommission
xmlBuff.append("<tax_env><![CDATA["+ taxEnv +"]]></tax_env>"); xmlBuff.append("<tax_env><![CDATA["+ taxEnv +"]]></tax_env>");
xmlBuff.append("<acct_code><![CDATA["+ acctcodeDeduct +"]]></acct_code>"); xmlBuff.append("<acct_code><![CDATA["+ acctcodeDeduct +"]]></acct_code>");
xmlBuff.append("<cctr_code><![CDATA["+ cctrcodeDeduct +"]]></cctr_code>"); xmlBuff.append("<cctr_code><![CDATA["+ cctrcodeDeduct +"]]></cctr_code>");
xmlBuff.append("<tax_amt><![CDATA[0]]></tax_amt>");
xmlBuff.append("<net_amt><![CDATA["+ expAmt * -1 +"]]></net_amt>"); xmlBuff.append("<net_amt><![CDATA["+ expAmt * -1 +"]]></net_amt>");
xmlBuff.append("<drcr_amt><![CDATA["+ (expAmt * -1) * (exchRate/crntExchrate) +"]]></drcr_amt>"); xmlBuff.append("<drcr_amt><![CDATA["+ (expAmt * -1) * (exchRate/crntExchrate) +"]]></drcr_amt>");
if (jvExchrate == 0 ) if (jvExchrate == 0 )
...@@ -1405,6 +1418,7 @@ public class CalculateCommission ...@@ -1405,6 +1418,7 @@ public class CalculateCommission
xmlBuff.append("<exch_rate__inv><![CDATA["+ jvExchrate +"]]></exch_rate__inv>"); xmlBuff.append("<exch_rate__inv><![CDATA["+ jvExchrate +"]]></exch_rate__inv>");
xmlBuff.append("</Detail2>"); xmlBuff.append("</Detail2>");
} }
}
//} //}
...@@ -1422,15 +1436,17 @@ public class CalculateCommission ...@@ -1422,15 +1436,17 @@ public class CalculateCommission
System.out.println("Size of drnList ["+drnList.size() + "]"); System.out.println("Size of drnList ["+drnList.size() + "]");
DrCrInvConf drCrInvConf = new DrCrInvConf(); DrCrInvConf drCrInvConf = new DrCrInvConf();
tranIdList = null;
tranIdList = new ArrayList<String>();
for (int ctr = 0; ctr < drnList.size(); ctr++) for (int ctr = 0; ctr < drnList.size(); ctr++)
{ {
tranIdDrn = ""; tranIdDrn = "";
xmlString = (String) drnList.get(ctr); xmlString = (String) drnList.get(ctr);
System.out.println("saveDataDrn [" + ctr + "] xmlString ["+xmlString + "]"); System.out.println("saveDataDrn [" + ctr + "] xmlString ["+xmlString + "]");
errString = saveDataDrn(siteCode,xmlString,conn); errString = saveDataDrn(siteCode,xmlString,conn);
if((errString == null || errString.trim().length() ==0) && ("Y".equals(post)) ) if((errString == null || errString.trim().length() ==0) && ("Y".equals(post)) )
{ {
tranIdList.add(tranIdDrn);
errString = drCrInvConf.confirm(tranIdDrn,xtraParams,"N", conn); errString = drCrInvConf.confirm(tranIdDrn,xtraParams,"N", conn);
if(errString.indexOf("VTCICONF3") > -1) if(errString.indexOf("VTCICONF3") > -1)
{ {
...@@ -1686,8 +1702,6 @@ public class CalculateCommission ...@@ -1686,8 +1702,6 @@ public class CalculateCommission
{ {
return errString; return errString;
} }
}
sql = "update misc_payables set hold_amt = ? where ref_no = ? and tran_ser = 'P-IBCA'"; sql = "update misc_payables set hold_amt = ? where ref_no = ? and tran_ser = 'P-IBCA'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, amount); pstmt.setDouble(1, amount);
...@@ -1695,6 +1709,8 @@ public class CalculateCommission ...@@ -1695,6 +1709,8 @@ public class CalculateCommission
pstmt.executeUpdate(); pstmt.executeUpdate();
} }
}
else else
{ {
break; break;
...@@ -1708,7 +1724,11 @@ public class CalculateCommission ...@@ -1708,7 +1724,11 @@ public class CalculateCommission
if(errString == null || errString.trim().length() == 0) if(errString == null || errString.trim().length() == 0)
{ {
//for ll_cnt = 1 to lds_drcr_inv_hdr.rowcount() //for ll_cnt = 1 to lds_drcr_inv_hdr.rowcount()
errString = gbfCreateCrdrAdj(autoTranId,calledFrom, conn); for (int ctr = 0; ctr < tranIdList.size(); ctr++)
{
tranIdDrn = (String) tranIdList.get(ctr);
errString = gbfCreateCrdrAdj(tranIdDrn,calledFrom, conn);
}
} }
} }
...@@ -1732,7 +1752,7 @@ public class CalculateCommission ...@@ -1732,7 +1752,7 @@ public class CalculateCommission
String invibcagen = "", site = "", cust = "", sitePay = "", finentFr = "", finentTo = "", acctTo = "", String invibcagen = "", site = "", cust = "", sitePay = "", finentFr = "", finentTo = "", acctTo = "",
cctrTo = "" , link = "" , acctFr = "", cctrFr = "", ibcaId = "" , currCd = "" , acct = "", cctr = "", cctrTo = "" , link = "" , acctFr = "", cctrFr = "", ibcaId = "" , currCd = "" , acct = "", cctr = "",
bank = "" , reftype = "" , crterm = "" , sundryCode = "" , sundryType = "" , finEntity = "" , bank = "" , reftype = "" , crterm = "" , sundryCode = "" , sundryType = "" , finEntity = "" ,
itemSer = "" ,drTranId = "" , errcode = "" , remark = "" , salesPers = "" ,taxClass = "" , itemSer = "" ,errcode = "" , remark = "" , salesPers = "" ,taxClass = "" ,
taxChap = "" , taxEnv = "" , reasCode = "" , itemCode = "" ,tranId = "" , keystr = "" , mpadjTranid = "" , taxChap = "" , taxEnv = "" , reasCode = "" , itemCode = "" ,tranId = "" , keystr = "" , mpadjTranid = "" ,
mpayTranid = "" , confDrcrOpt = "", acctCodeCf = "" , cctrCodeCf = "" , crTranId = "", mpayTranid = "" , confDrcrOpt = "", acctCodeCf = "" , cctrCodeCf = "" , crTranId = "",
invoiceid = "" , transerCr = "" ,autoLinktype = "" , autoConfirm = "" , transerDb = "" , sql = "" , invoiceid = "" , transerCr = "" ,autoLinktype = "" , autoConfirm = "" , transerDb = "" , sql = "" ,
...@@ -1744,7 +1764,7 @@ public class CalculateCommission ...@@ -1744,7 +1764,7 @@ public class CalculateCommission
java.sql.Timestamp dueDate = null; java.sql.Timestamp dueDate = null;
java.sql.Timestamp Date = null; java.sql.Timestamp Date = null;
double exch =0.0, factor=0.0, discount =0.0 , amountBc = 0.0 , amount = 0.0, taxAmt = 0.0 , double exch =0.0, factor=0.0, discount =0.0 , amountBc = 0.0 , taxAmt = 0.0 ,
netAmt = 0.0 , drcrAmt = 0.0 , totamt = 0.0 , adjamt = 0.0 , rows = 0 , totrow = 0 ; netAmt = 0.0 , drcrAmt = 0.0 , totamt = 0.0 , adjamt = 0.0 , rows = 0 , totrow = 0 ;
int cnt = 0; int cnt = 0;
...@@ -1752,7 +1772,7 @@ public class CalculateCommission ...@@ -1752,7 +1772,7 @@ public class CalculateCommission
ResultSet rs = null; ResultSet rs = null;
try { try {
sql = "select invoice_id, sundry_code, amount, site_code, curr_code from drcr_inv" + sql = "select invoice_id, sundry_code, amount, site_code, curr_code from drcr_inv " +
" where tran_id = ? and drcr_flag = 'D' " ; " where tran_id = ? and drcr_flag = 'D' " ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1762,7 +1782,7 @@ public class CalculateCommission ...@@ -1762,7 +1782,7 @@ public class CalculateCommission
{ {
invoiceid = rs.getString(1); invoiceid = rs.getString(1);
sundryCode = rs.getString(2); sundryCode = rs.getString(2);
amount = rs.getDouble(3); netAmt = rs.getDouble(3);
site = rs.getString(4); site = rs.getString(4);
currCd = rs.getString(5); currCd = rs.getString(5);
} }
...@@ -1845,7 +1865,7 @@ public class CalculateCommission ...@@ -1845,7 +1865,7 @@ public class CalculateCommission
"and det.sundry_code = ? and det.ref_ser = 'DRNINV' and det.ref_no = ?" ; "and det.sundry_code = ? and det.ref_ser = 'DRNINV' and det.ref_no = ?" ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode); pstmt.setString(1, sundryCode);
pstmt.setString(2, drTranId); pstmt.setString(2, dbnoteId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -1896,21 +1916,22 @@ public class CalculateCommission ...@@ -1896,21 +1916,22 @@ public class CalculateCommission
return errString; return errString;
} }
now = new java.sql.Timestamp(System.currentTimeMillis()) ;
sql = "UPDATE misc_payables SET status = (case when (adj_amt + ?) = tot_amt then 'A' else 'P' end)," + sql = "UPDATE misc_payables SET status = (case when (adj_amt + ?) = tot_amt then 'A' else 'P' end)," +
"status_date = ?, adj_amt = (case when adj_amt is null then 0 else adj_amt end) + ? WHERE tran_ser = ?" + "status_date = ?, adj_amt = (case when adj_amt is null then 0 else adj_amt end) + ? WHERE tran_ser = ?" +
" AND ref_no = ? AND sundry_code = ?" ; " AND ref_no = ? AND sundry_code = ?" ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, netAmt); pstmt.setDouble(1, netAmt);
pstmt.setDate(2, new java.sql.Date(Date.getTime())); pstmt.setTimestamp(2, now);
pstmt.setDouble(3, netAmt); pstmt.setDouble(3, netAmt);
pstmt.setString(4, transerCr); pstmt.setString(4, transerCr);
pstmt.setString(5, tranId); pstmt.setString(5, dbnoteId);
pstmt.setString(6, sundryCode); pstmt.setString(6, sundryCode);
pstmt.executeUpdate(); pstmt.executeUpdate();
rs.close(); //rs.close();
rs = null; //rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -1954,7 +1975,7 @@ public class CalculateCommission ...@@ -1954,7 +1975,7 @@ public class CalculateCommission
sql = "select count(1) from misc_payables where ref_no = ? and tran_ser = 'P-IBCA'"; sql = "select count(1) from misc_payables where ref_no = ? and tran_ser = 'P-IBCA'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, drTranId); pstmt.setString(1, dbnoteId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -1977,7 +1998,8 @@ public class CalculateCommission ...@@ -1977,7 +1998,8 @@ public class CalculateCommission
sql = "select tran_id from misc_payables where tran_ser = 'DRNINV' and ref_no = ? and sundry_code = ?"; sql = "select tran_id from misc_payables where tran_ser = 'DRNINV' and ref_no = ? and sundry_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, drTranId); pstmt.setString(1, dbnoteId);
pstmt.setString(2, sundryCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -1989,17 +2011,18 @@ public class CalculateCommission ...@@ -1989,17 +2011,18 @@ public class CalculateCommission
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
now = new java.sql.Timestamp(System.currentTimeMillis()) ;
sql = "UPDATE misc_payables SET adj_amt = ? * -1, status = 'A', status_date = ? where tran_ser = ? AND ref_no = ? AND sundry_code = ?"; sql = "UPDATE misc_payables SET adj_amt = ? * -1, status = 'A', status_date = ? where tran_ser = ? AND ref_no = ? AND sundry_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDate(1, new java.sql.Date(Date.getTime())); pstmt.setDouble(1, netAmt);
pstmt.setString(2, transerDb); pstmt.setTimestamp(2, now);
pstmt.setString(3, tranId); pstmt.setString(3, transerDb);
pstmt.setString(4, sundryCode); pstmt.setString(4, dbnoteId);
pstmt.setString(5, sundryCode);
pstmt.executeUpdate(); pstmt.executeUpdate();
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -2008,7 +2031,7 @@ public class CalculateCommission ...@@ -2008,7 +2031,7 @@ public class CalculateCommission
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mpadjTranid); pstmt.setString(1, mpadjTranid);
pstmt.setString(2, "DRNINV"); pstmt.setString(2, "DRNINV");
pstmt.setString(3, drTranId); pstmt.setString(3, dbnoteId);
pstmt.setDouble(4, netAmt); pstmt.setDouble(4, netAmt);
pstmt.setDouble(5, netAmt); pstmt.setDouble(5, netAmt);
pstmt.setString(6, "CRNINV"); pstmt.setString(6, "CRNINV");
...@@ -2017,8 +2040,6 @@ public class CalculateCommission ...@@ -2017,8 +2040,6 @@ public class CalculateCommission
pstmt.setString(9, mpayTranid); pstmt.setString(9, mpayTranid);
pstmt.executeUpdate(); pstmt.executeUpdate();
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -2034,6 +2055,17 @@ public class CalculateCommission ...@@ -2034,6 +2055,17 @@ public class CalculateCommission
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
xmlValues = "";
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id/>";
xmlValues = xmlValues + "<site_code>" + site + "</site_code>";
xmlValues = xmlValues + "<tran_date>"+ sdf.format(tranDate) + "</tran_date>";
xmlValues = xmlValues + "</Detail1></Root>";
//TransIDGenerator tg = new TransIDGenerator(xmlValues, "SYSTEM", CommonConstants.DB_NAME);
mpadjTranid = tg.generateTranSeqID("PAYADJ", "tran_id", keyString, conn);
sql = " INSERT INTO misc_payables_adj (tran_id, ref_ser, ref_no, tot_amt, adj_amt, ref_ser_adj,ref_no_adj, net_amt, tran_id__pay)" + sql = " INSERT INTO misc_payables_adj (tran_id, ref_ser, ref_no, tot_amt, adj_amt, ref_ser_adj,ref_no_adj, net_amt, tran_id__pay)" +
"VALUES (?,?,?,?,?,?,?,?,?)"; "VALUES (?,?,?,?,?,?,?,?,?)";
...@@ -2049,8 +2081,6 @@ public class CalculateCommission ...@@ -2049,8 +2081,6 @@ public class CalculateCommission
pstmt.setString(9, mpayTranid); pstmt.setString(9, mpayTranid);
pstmt.executeUpdate(); pstmt.executeUpdate();
rs.close();
rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
......
...@@ -652,7 +652,8 @@ public class DrCrInvConf extends ActionHandlerEJB implements DrCrInvConfLocal,Dr ...@@ -652,7 +652,8 @@ public class DrCrInvConf extends ActionHandlerEJB implements DrCrInvConfLocal,Dr
DetList.add(DetMap); DetList.add(DetMap);
} }
// insert the drcr_acct before posting // insert the drcr_acct before posting
sql = "Insert into drcr_invacct (TRAN_ID,LINE_NO,ACCT_CODE,CCTR_CODE,EXCH_RATE__INV,AMOUNT,EMP_CODE,ANAL_CODE) values (?,?,?,?,?,?,?,?)"; //sql = "Insert into drcr_invacct (TRAN_ID,LINE_NO,ACCT_CODE,CCTR_CODE,EXCH_RATE__INV,AMOUNT,EMP_CODE,ANAL_CODE) values (?,?,?,?,?,?,?,?)";
sql = "Insert into drcr_invacct (TRAN_ID,LINE_NO,ACCT_CODE,CCTR_CODE,EXCH_RATE__INV,AMOUNT) values (?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
int maxline = 0; int maxline = 0;
System.out.println("08/01/15 DetList ["+DetList.toString() + "]"); System.out.println("08/01/15 DetList ["+DetList.toString() + "]");
...@@ -677,8 +678,8 @@ public class DrCrInvConf extends ActionHandlerEJB implements DrCrInvConfLocal,Dr ...@@ -677,8 +678,8 @@ public class DrCrInvConf extends ActionHandlerEJB implements DrCrInvConfLocal,Dr
pstmt.setString(4,cctrCode); pstmt.setString(4,cctrCode);
pstmt.setDouble(5,(double) Double.parseDouble( "" +DetMap.get("exch_rate"))); pstmt.setDouble(5,(double) Double.parseDouble( "" +DetMap.get("exch_rate")));
pstmt.setDouble(6,(double) Double.parseDouble( "" +DetMap.get("amount"))); pstmt.setDouble(6,(double) Double.parseDouble( "" +DetMap.get("amount")));
pstmt.setString(7,(String) DetMap.get("emp_code")); //pstmt.setString(7,(String) DetMap.get("emp_code"));
pstmt.setString(8,(String) DetMap.get("anal_code")); //pstmt.setString(8,(String) DetMap.get("anal_code"));
pstmt.addBatch(); pstmt.addBatch();
pstmt.clearParameters(); pstmt.clearParameters();
} }
......
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