Commit 27ecec89 authored by pshinde's avatar pshinde

Source Code for Automatic Payment Scheduler


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98095 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 61d6c84a
......@@ -293,7 +293,8 @@ public class AutoPmtGenPrc extends ProcessEJB implements AutoPmtGenPrcLocal,Auto
+"misc_payables.pay_mode like '" + payMode + "' AND "
+"case when misc_payables.entry_batch_no is null then ' ' else"
+" misc_payables.entry_batch_no end like '"+entryBatchNo+"' AND "
+" curr_code ='"+ currCode + "'"
+" curr_code ='"+ currCode + "'AND"
+" tran_ser NOT in('P-ADV ','M-ADV ')"
+" ORDER BY misc_payables.sundry_type ASC,"
+"misc_payables.sundry_code ASC,"
+"misc_payables.ref_no ASC";
......@@ -562,6 +563,7 @@ public class AutoPmtGenPrc extends ProcessEJB implements AutoPmtGenPrcLocal,Auto
String wfStatus="";
String spiltChq="";
String stanCode="";
String tranDate="";
double diffAmt=0;
String retString = "";
......@@ -617,7 +619,9 @@ public class AutoPmtGenPrc extends ProcessEJB implements AutoPmtGenPrcLocal,Auto
FinCommon fin=new FinCommon();
DistCommon dist=new DistCommon();
double unconfirmAmt=0; // cpatil
HashMap<String,String> maxDateMap=new HashMap<String, String>();
String chq1="",chq2="";
String refDate1="";
try
{ System.out.println("intializingLog$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$........."+ intializingLog("Gen_bank_payment_log"));
retBuf = new StringBuffer();
......@@ -702,6 +706,9 @@ System.out.println("Getting winName============"+windowName);
spiltChq = genericUtility.getColumnValue("chq_split",headerDom);
System.out.println("Getting spiltChq=============="+spiltChq);
/*refDate1 = genericUtility.getColumnValue("ref_date",detailDom);
System.out.println("Getting refDate1111=============="+refDate1);*/
/* acctCode = genericUtility.getColumnValue("acct_code",headerDom);
System.out.println("Getting acct_code__bal================"+acctCode);*/
//writeLog(filePtr,"uptoChq-->"+uptoChq,true);
......@@ -859,10 +866,12 @@ System.out.println("Getting winName============"+windowName);
String tmpDate = childNode.getFirstChild().getNodeValue();
if (tmpDate.length()>10)
{
tmpDate = tmpDate.substring(0,9);
tmpDate = tmpDate.substring(0,10);
}
System.out.println("tmpDate ######"+tmpDate);
//refDate = childNode.getFirstChild().getNodeValue();
refDate = genericUtility.getValidDateString(tmpDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat());
System.out.println("refDate from all ====="+refDate);
}
}
if (childNodeName.equals("bill_no"))
......@@ -1057,6 +1066,23 @@ System.out.println("Getting winName============"+windowName);
tempSplitCode = sundryCode+"@"+payMode;
}
if(maxDateMap.containsKey(tempSplitCode))
{
String tempPrvMaxDate=maxDateMap.get(tempSplitCode);
if(sdf.parse(tempPrvMaxDate).compareTo(sdf.parse(dueDate)) < 0)
{
maxDateMap.put(tempSplitCode, dueDate);
}
}
else
{
maxDateMap.put(tempSplitCode, dueDate);
}
System.out.println("Getting combination As====="+tempSplitCode);
if(splitCodeWiseMap.containsKey(tempSplitCode))
{
......@@ -1302,27 +1328,33 @@ System.out.println("Sundry Type@@@@"+sundryType);
System.out.println("Length---"+splitCode.split("@").length);
tempList = (ArrayList)splitCodeWiseMap.get(splitCode);
System.out.println("TempList Inside While======="+tempList);
if(splitCode.split("@").length != 0)
{
sundryCode = checkNull(splitCode.split("@")[0]);
payMode = checkNull(splitCode.split("@")[1]);
dueDate = checkNull(splitCode.split("@")[2]); // added by cpatil @sun on 06/06/15
if("Y".equalsIgnoreCase(spiltChq))
{
dueDate = checkNull(splitCode.split("@")[2]);
}
// added by cpatil @sun on 06/06/15
}
System.out.println("sundryCode after spilt ======="+sundryCode);
System.out.println("payMode after spilt ======="+payMode);
System.out.println("Sundry TYPEEEEEEEE" +sundryType);
System.out.println("dueDate after spilt ======="+dueDate); // added by cpatil @sun on 06/06/15
System.out.println("TempList Inside While======="+tempList);
sundryType=(String)tempMap.get("sundry_type");
System.out.println("Sundry Type from Map ======="+sundryType);
System.out.println("sundryCode before setting ref date ======="+sundryCode);
System.out.println("payMode before setting ref date ======="+payMode);
//set max due_date as ref_date in header
Date currentDate1 = new Date();
//set max due_date as ref_date in header
/* Date currentDate1 = new Date();
sql="select max(due_date) as due_date from misc_payables where sundry_code =? and pay_mode=?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,sundryCode);
......@@ -1339,18 +1371,34 @@ System.out.println("Sundry Type@@@@"+sundryType);
System.out.println("maxDueDate ref date ======="+maxDueDate);
String maxDatedue= sdf.format(maxDueDate);
System.out.println("Max Date========="+maxDatedue);
*/
// Date currentDate1 = new Date();
System.out.println("Current date111111111111===="+currentDate1);
if(maxRefDate!=null && maxRefDate.compareTo(currentDate1)>0)
String maxDateRef=maxDateMap.get(splitCode);
System.out.println("Max Due Date from MAp=="+maxDateRef+"splitCode==="+splitCode);
if(maxDateRef!=null && sdf.parse(maxDateRef).compareTo(currentDate1)>0)
{
dueMaxDate=sdf.parse(maxDateRef);
}
else
{
dueMaxDate=currentDate1;
}
/* if(maxRefDate!=null && maxRefDate.compareTo(currentDate1)>0)
{
dueMaxDate=maxDueDate;
}
else
{
dueMaxDate=currentDate1;
}
}*/
System.out.println("Getting ref due Date for header===="+dueMaxDate);
System.out.println("sfld1========="+sfld1);
......@@ -1389,7 +1437,7 @@ System.out.println("Sundry Type@@@@"+sundryType);
//set Ref No in header whose date is maximum against combination
sql="select ref_no from misc_payables where ref_date= ?";
/*sql="select ref_no from misc_payables where ref_date= ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setDate(1,(java.sql.Date) maxRefDate);
rs1 = pstmt1.executeQuery();
......@@ -1402,12 +1450,37 @@ System.out.println("Sundry Type@@@@"+sundryType);
pstmt1.close();
pstmt1 = null;
System.out.println("Ref No aginst maxRefDate ref date ======="+refNo);
*/
sql = "SELECT chq1,chq2 FROM BANK WHERE BANK_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,bankCode);
rs = pstmt.executeQuery();
if (rs.next())
{
chq1= checkNull(rs.getString(1));
chq2= checkNull(rs.getString(2));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Chq1========="+chq1);
System.out.println("chq2========="+chq2);
String maxRefNo="0";
if(chq1!=null & chq1.trim().length()>0 && chq2!=null & chq2.trim().length()>0)
{
if(Integer.parseInt(chq1)>Integer.parseInt(chq2))
{
maxRefNo=""+Integer.parseInt(chq1)+1;
}
}
System.out.println("Ref No To be set in Header ======="+maxRefNo);
for (int itemCtr = 0; itemCtr < tempList.size(); itemCtr++)
{
tempMap = (HashMap)tempList.get(itemCtr);
......@@ -1449,8 +1522,16 @@ System.out.println("Sundry Type@@@@"+sundryType);
xmlString.append("<sundry_code><![CDATA[" + checkNull(sundryCode) + "]]></sundry_code>");
xmlString.append("<pay_mode><![CDATA[" + payMode + "]]></pay_mode>");
xmlString.append("<bank_code><![CDATA[" + checkNull(bankCode) + "]]></bank_code>");
xmlString.append("<ref_no><![CDATA[" + checkNull(refNo) + "]]></ref_no>");
if("Q".equalsIgnoreCase(payMode) || "D".equalsIgnoreCase(payMode))
{
xmlString.append("<ref_no><![CDATA[" + checkNull(maxRefNo) + "]]></ref_no>");
}
else
{
xmlString.append("<ref_no><![CDATA[" + " " + "]]></ref_no>");
}
//xmlString.append("<ref_no><![CDATA[" + checkNull(refNo) + "]]></ref_no>");
//xmlString.append("<ref_no><![CDATA[" + " " + "]]></ref_no>");
xmlString.append("<ref_date><![CDATA[" +sdf.format(dueMaxDate).toString() + "]]></ref_date>");
//xmlString.append("<ref_date>").append("<![CDATA[").append(sdf.format(currentDate).toString()).append("]]></ref_date>\r\n");
//xmlString.append("<ref_date><![CDATA[" + dueDate + "]]></ref_date>");
......@@ -1567,9 +1648,9 @@ System.out.println("Sundry Type@@@@"+sundryType);
xmlString.append("<line_no><![CDATA["+lineNo+"]]></line_no>");
xmlString.append("<tran_ser><![CDATA["+ tempMap.get("tran_ser") +"]]></tran_ser>");
xmlString.append("<vouch_no><![CDATA["+ tempMap.get("vouch_no") +"]]></vouch_no>");
//xmlString.append("<vouch_date><![CDATA["+ tempMap.get("vouch_date") +"]]></vouch_date>");
xmlString.append("<vouch_date><![CDATA["+ tempMap.get("vouch_date") +"]]></vouch_date>");
xmlString.append("<vouch_date><![CDATA["+ sdf.format(refrdate).toString() +"]]></vouch_date>");
//xmlString.append("<vouch_date><![CDATA["+ sdf.format(refrdate).toString() +"]]></vouch_date>");
xmlString.append("<net_amt><![CDATA["+ tempMap.get("net_amt") +"]]></net_amt>");
xmlString.append("<pay_amt><![CDATA["+ tempMap.get("pay_amt") +"]]></pay_amt>");
xmlString.append("<curr_code><![CDATA["+ tempMap.get("curr_code") +"]]></curr_code>");
......
......@@ -422,7 +422,7 @@ public class AutoPmtPrcSch implements Schedule
unConfAmt=arr[26];
spiltChq=arr[27];
System.out.println("Unconfirmed Amt from Array==="+unConfAmt+"Spilt cheque variable===="+spiltChq);
System.out.println("effDate========"+effDate);
xmlString4=xmlString4+"<Detail2 dbID=\"\" domID='"+ctr+"' objContext=\"2\" objName=\"miscpay_auto\"><attribute pkNames=\"\" selected=\"N\" status=\"N\" updateFlag=\"A\"/>null"+
"<ref_no><![CDATA["+vouchurNo+"]]></ref_no>"+
"<tran_date><![CDATA["+miscPaytranDate+"]]></tran_date>"+
......
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