Commit 8406e448 authored by kshinde's avatar kshinde

added station code

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182084 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0e020cc8
......@@ -307,24 +307,26 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
pstmt.close();
rs.close();
if("R".equalsIgnoreCase(startFrom))
{
ldStartDate=refDate;
}
else if("D".equalsIgnoreCase(startFrom) || "Q".equalsIgnoreCase(startFrom))
{
ldStartDate=effDate;
}
else if("B".equalsIgnoreCase(startFrom))
if(startFrom!=null && startFrom.trim().length()>0 )
{
ldStartDate=billDate;
}
if((today.after(ldStartDate) || today.equals(ldStartDate)) && (today.before(ldDiscountDt) || today.equals(ldDiscountDt)))
{
lcDiscountAmt=(payAmt*lcDiscount)/100;
if("R".equalsIgnoreCase(startFrom))
{
ldStartDate=refDate;
}
else if("D".equalsIgnoreCase(startFrom) || "Q".equalsIgnoreCase(startFrom))
{
ldStartDate=effDate;
}
else if("B".equalsIgnoreCase(startFrom))
{
ldStartDate=billDate;
}
if((today.after(ldStartDate) || today.equals(ldStartDate)) && (today.before(ldDiscountDt) || today.equals(ldDiscountDt)))
{
lcDiscountAmt=(payAmt*lcDiscount)/100;
}
}
}
......@@ -334,7 +336,7 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
//09062007 (set currCode bc with Curr Code
currCodeBc = currCode;
String stanCode=getStanDraw(sundryType, sundryCode, conn);
StringBuffer xmlBuff = new StringBuffer();
......@@ -423,6 +425,7 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
xmlBuff.append("<cctr_code__ap><![CDATA[" + cctrCode + "]]></cctr_code__ap>");
xmlBuff.append("<sundry_type><![CDATA[" + sundryType + "]]></sundry_type>");
xmlBuff.append("<sundry_code><![CDATA[" + sundryCode + "]]></sundry_code>");
xmlBuff.append("<stan_code><![CDATA[" + (stanCode) + "]]></stan_code>");
xmlBuff.append("<bank_charges><![CDATA[" + 0 + "]]></bank_charges>");
//xmlBuff.append("<tax_env><![CDATA[" + taxEnv + "]]></tax_env>");
xmlBuff.append("<line_no><![CDATA[" + 1 + "]]></line_no>");
......@@ -738,6 +741,163 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
return difference;
}
public String getStanDraw(String sundryType, String sundryCode, Connection conn)
throws ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = ""; String stanCode = ""; String empCode = "";
try
{
System.out.println(">>>>>>>>>Enter in getStanDraw method");
System.out.println(">>>>>>>>sundryType===" + sundryType);
System.out.println(">>>>>>>>sundryCode===" + sundryCode);
if ((sundryType != null) && (sundryType.trim().length() > 0) && ("E".equalsIgnoreCase(sundryType)))
{
sql = "select stan_code from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stanCode = checkNull(rs.getString("stan_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("StanCode from Sundry type=E>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("S".equalsIgnoreCase(sundryType)))
{
sql = "select stan_code from supplier where supp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stanCode = checkNull(rs.getString("stan_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("StanCode from Sundry type= S>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("C".equalsIgnoreCase(sundryType)))
{
sql = "select stan_code from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stanCode = checkNull(rs.getString("stan_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("StanCode from Sundry type=C>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("P".equalsIgnoreCase(sundryType)))
{
sql = "select emp_code from sales_pers where sales_pers = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode);
rs = pstmt.executeQuery();
if (rs.next())
{
empCode = checkNull(rs.getString("emp_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("empCode from Sundry type=P>>>>>>" + empCode);
if ((empCode != null) && (empCode.trim().length() > 0))
{
sql = "select stan_code from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stanCode = checkNull(rs.getString("stan_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("StanCode from Sundry type=P>>>>>>" + stanCode);
}
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("T".equalsIgnoreCase(sundryType)))
{
sql = "select stan_code from transporter where tran_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stanCode = checkNull(rs.getString("stan_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("StanCode from Sundry type= T>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("X".equalsIgnoreCase(sundryType)))
{
sql = "select stan_code from tax_authority where tauth_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sundryCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stanCode = checkNull(rs.getString("stan_code"));
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
System.out.println("StanCode from Sundry type= X>>>>>>" + stanCode);
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
throw new ITMException(e);
}
//Changed by wasim to add finally block [START]
finally
{
try
{
if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
if(rs!=null)
{
rs.close();rs=null;
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
//Changed by wasim to add finally block [END]
return stanCode;
}
}
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