Commit 8b8bde25 authored by manohar's avatar manohar

Bug fixing commission debit note


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97100 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ece4d7e8
......@@ -742,7 +742,8 @@ public class CalculateCommission
commMap.put("sorder_no" , rs.getString("sorder_no"));
commMap.put("curr_code_sp" , rs.getString("curr_code_sp"));
commMap.put("exch_rate_sp" , rs.getDouble("exch_rate_sp"));
commMap.put("comm_amt" , rs.getDouble("comm_amt"));
commtList.add(commMap);
}
......@@ -1307,103 +1308,106 @@ public class CalculateCommission
sretPerc = (sretNetAmt* sretExchRate *100)/ invNetamt* exchRate;
}
netAmt = netAmt * sretPerc / 100;
xmlBuff.append("<drcr_amt><![CDATA["+ drcrAmt +"]]></drcr_amt>");
}
}
drcrAmt = netAmt;
xmlBuff.append("<drcr_amt><![CDATA["+ drcrAmt +"]]></drcr_amt>");
oldsp = salesPers;
currcdSpOld = currcodeSp ;
oldsp = salesPers;
currcdSpOld = currcodeSp ;
sql = "select due_date from invoice where invoice_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceNo);
rs = pstmt.executeQuery();
if(rs.next())
{
dueDate = rs.getTimestamp(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("1................ dueDate ["+dueDate + "] date [" + date + "]");
day = utilMethods.DaysAfter(dueDate, date);
sql = "select due_date from invoice where invoice_id = ?";
if(day >0 )
{
sql = "select fin_chg,fchg_type from crtermfc " +
"where (min_day <= ? and max_day >= ? ) and cr_term = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, invoiceNo);
pstmt.setString(1, crTerm);
rs = pstmt.executeQuery();
if(rs.next())
{
dueDate = rs.getTimestamp(1);
finChg = rs.getDouble(1);
fchgType = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("1................ dueDate ["+dueDate + "] date [" + date + "]");
day = utilMethods.DaysAfter(dueDate, date);
if(day >0 )
else
{
sql = "select fin_chg,fchg_type from crtermfc " +
"where (min_day <= ? and max_day >= ? ) and cr_term = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, crTerm);
rs = pstmt.executeQuery();
if(rs.next())
if("P".equalsIgnoreCase(fchgType))
{
finChg = rs.getDouble(1);
fchgType = rs.getString(1);
expAmt = drcrmt * (finChg/100);
drcrmt = drcrmt - finChg;
}
else
{
if("P".equalsIgnoreCase(fchgType))
{
expAmt = drcrmt * (finChg/100);
drcrmt = drcrmt - finChg;
}
else
{
expAmt = finChg/100;
drcrmt = drcrmt - finChg;
}
//xmlBuff.append("<amount><![CDATA["+ totNetAmt +"]]></amount>");
//xmlBuff.append("<amount__bc><![CDATA["+ (totNetAmt-expAmt) +"]]></amount__bc>");
expAmt = finChg/100;
drcrmt = drcrmt - finChg;
}
//xmlBuff.append("<amount><![CDATA["+ totNetAmt +"]]></amount>");
//xmlBuff.append("<amount__bc><![CDATA["+ (totNetAmt-expAmt) +"]]></amount__bc>");
acctcodeDeduct = finCommon.getFinparams("999999", "DEDUCT_COMM_ACCT", conn);
if("NULLFOUND".equalsIgnoreCase(acctcodeDeduct)|| acctcodeDeduct == null || acctcodeDeduct.trim().length() == 0)
acctcodeDeduct = finCommon.getFinparams("999999", "DEDUCT_COMM_ACCT", conn);
if("NULLFOUND".equalsIgnoreCase(acctcodeDeduct)|| acctcodeDeduct == null || acctcodeDeduct.trim().length() == 0)
{
acctcodeDeduct = acctcodeExp;
cctrcodeDeduct = cctrcodeExp;
}
else
{
cctrcodeDeduct = finCommon.getFinparams("999999", "DEDUCT_COMM_CCTR", conn);
if("NULLFOUND".equalsIgnoreCase(cctrcodeDeduct)|| cctrcodeDeduct == null || cctrcodeDeduct.trim().length() == 0)
{
acctcodeDeduct = acctcodeExp;
cctrcodeDeduct = cctrcodeExp;
}
else
{
cctrcodeDeduct = finCommon.getFinparams("999999", "DEDUCT_COMM_CCTR", conn);
if("NULLFOUND".equalsIgnoreCase(cctrcodeDeduct)|| cctrcodeDeduct == null || cctrcodeDeduct.trim().length() == 0)
{
cctrcodeDeduct = cctrcodeExp;
}
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"drcrinv\" objContext=\"2\">");
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["+ acctcodeDeduct +"]]></acct_code>");
xmlBuff.append("<cctr_code><![CDATA["+ cctrcodeDeduct +"]]></cctr_code>");
xmlBuff.append("<net_amt><![CDATA["+ expAmt * -1 +"]]></net_amt>");
xmlBuff.append("<drcr_amt><![CDATA["+ (expAmt * -1) * (exchRate/crntExchrate) +"]]></drcr_amt>");
if (jvExchrate == 0 )
{
jvExchrate = 1;
}
xmlBuff.append("<exch_rate__inv><![CDATA["+ jvExchrate +"]]></exch_rate__inv>");
xmlBuff.append("</Detail2>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"drcrinv\" objContext=\"2\">");
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["+ acctcodeDeduct +"]]></acct_code>");
xmlBuff.append("<cctr_code><![CDATA["+ cctrcodeDeduct +"]]></cctr_code>");
xmlBuff.append("<net_amt><![CDATA["+ expAmt * -1 +"]]></net_amt>");
xmlBuff.append("<drcr_amt><![CDATA["+ (expAmt * -1) * (exchRate/crntExchrate) +"]]></drcr_amt>");
if (jvExchrate == 0 )
{
jvExchrate = 1;
}
xmlBuff.append("<exch_rate__inv><![CDATA["+ jvExchrate +"]]></exch_rate__inv>");
xmlBuff.append("</Detail2>");
}
//}
}
}
......
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