Commit 5a7e5efa authored by vvengurlekar's avatar vvengurlekar

removed the DB connection from source


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@105451 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 67a4816d
package ibase.dashboard.ssc.ejb;
import ibase.utility.E12GenericUtility;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
......@@ -23,9 +24,9 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
public PendingPurcOrder() {
}
E12GenericUtility e12GenericUtility = new E12GenericUtility();
SimpleDateFormat gridDateFormat = null;
SimpleDateFormat convrtToTimStmDate = null;
GenericUtility genericUtility = GenericUtility.getInstance();
SimpleDateFormat gridDateFormat=null;
SimpleDateFormat convrtToTimStmDate=null;
/*Last*/
@SuppressWarnings("unchecked")
......@@ -37,19 +38,23 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
try
{
if(loginCode!=null && loginCode.trim().length()>0)
{
gridDateFormat = new SimpleDateFormat( e12GenericUtility.getApplDateFormat());
convrtToTimStmDate = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
gridDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println(" Inside PendingPurcOrder for getPendingPO Method Data Soruc Name ="+dataSourceName+" loginCode comming from seesion =" + loginCode);
/*conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; */
/*add new code for connection DB on dated:14062016 by Nikhil*/
conn = getConnection();
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
int count = 0;
sql = " select m.tran_id,m.tran_date, m.net_amt,m.ref_no,m. bank_code,b.bank_name from misc_payment m inner join bank b on m.bank_code=b.bank_code " +
sql = " select m.tran_id,m.tran_date, m.net_amt,m.ref_no,m. bank_code,b.bank_name " +
"from misc_payment m inner join bank b on m.bank_code=b.bank_code " +
" where Rownum <= 5 and m.sundry_type = 'S'and m.net_amt>0 " +
" and m.sundry_code in (select entity_code from entity_contact where entity_type = 'S' " +
" and User_id__portal = '"+loginCode+"' ) "+
......@@ -123,6 +128,7 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
try
{
......@@ -131,10 +137,8 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
if(loginCode!=null && loginCode.trim().length()>0)
{
/*conn = connDriver.getConnectDB(dataSourceName);
connDriver = null; */
/*add new code for connection DB on dated:14062016 by Nikhil*/
conn = getConnection();
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
sql = " select to_char(ORD_DATE, 'MON-YY') as month, sum(tot_amt) as povalue,to_char(ORD_DATE,'MMYY'),count(1) as no_of_po "+
" from porder where ORD_DATE >= (SELECT ADD_MONTHS(SYSDATE,-5) FROM DUAL ) "+
" and case when confirmed is null then 'N' else confirmed end = 'Y' "+
......@@ -198,20 +202,19 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
Calendar calendar = null;
String currentDate ="";
String varValue ="";
String[] lotNoList = null;
ConnDriver connDriver = new ConnDriver();
Calendar calendar=null;
String currentDate="";
String varValue="";
String[] lotNoList=null;
try
{
System.out.println(" Inside PendingPurcOrder for getPendingInvoice Method Data Soruc Name ="+dataSourceName+" logincode is =" + loginCode+"fromDate==="+fromDate+"ToDate==="+toDate);
if(loginCode!=null && loginCode.trim().length()>0)
{
/*conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;*/
/*add new code for connection DB on dated:14062016 by Nikhil*/
conn = getConnection();
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
// This is old sql for pending invoice detail.Changes by Birendra Pandey on dated :13/10/2015
sql ="select var_value from disparm where prd_code = '999999' and var_name = 'BILL_STATUS_REAS'";
pstmt = conn.prepareStatement(sql);
......@@ -247,12 +250,16 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
}
System.out.println("varValue after ["+varValue + "]");
if (varValue=="" || varValue==null)
{
varValue ="'Y'";
}
//SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy");
if((fromDate==null) ||(fromDate.equals("")) && (toDate==null) || (toDate.equals("")))
{
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( e12GenericUtility.getApplDateFormat());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
currentDate = simpleDateFormat.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
......@@ -265,17 +272,6 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
}
// end date utility block
/*sql= " SELECT SB.SUPP_CODE , S.SUPP_NAME , SUM(Case When SB.Reas_Codes IN ("+varValue+") " +
" Then 1 else 0 end ) as Hard_Copy_Not_Recd, SUM(Case When SB.Status !='Y' And SB.Voucher_No Is Null And SB.Reas_Codes Is Null Then 1 else 0 end) as In_Process, SUM( case when (select count(1) from misc_paydet where TRAN_SER = 'VOUCH' and VOUCH_NO = SB.Voucher_No ) = 0 then 1 else 0 end ) as Complete FROM SUPPLIER_BILL SB INNER JOIN SUPPLIER S ON S.SUPP_CODE = SB.SUPP_CODE " +
" WHERE TO_CHAR(SB.TRAN_DATE,'DD/MM/YY') >= '"+fromDate+"'" +
" AND TO_CHAR(SB.TRAN_DATE,'DD/MM/YY') <= '"+toDate+"' " +
" AND SB.supp_code in (select entity_code from entity_contact WHERE ENTITY_TYPE = 'S'" +
" AND USER_ID__PORTAL = 'CPATIL') " +
" GROUP BY SB.SUPP_CODE,S.SUPP_NAME " +
" ORDER BY S.SUPP_NAME ";*/
sql = "SELECT SB.SUPP_CODE , S.SUPP_NAME , SUM(CASE WHEN SB.REAS_CODES IN ("+varValue+") " +
"THEN 1 ELSE 0 END ) AS HARD_COPY_NOT_RECD, " +
"SUM(CASE WHEN SB.STATUS !='Y' And SB.Voucher_No Is Null And SB.Reas_Codes Is Null Then 1 else 0 end) as In_Process, " +
......@@ -302,6 +298,7 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
rawDataPendingInvoice.put(count, rowData);
count++;
}
}
}
catch (Exception e)
......@@ -344,18 +341,17 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
//String processOrder="",completed="",open="";
try
{
gridDateFormat = new SimpleDateFormat( e12GenericUtility.getApplDateFormat());
convrtToTimStmDate = new SimpleDateFormat(e12GenericUtility.getDBDateFormat());
gridDateFormat = new SimpleDateFormat( genericUtility.getApplDateFormat());
convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if(loginCode!=null && loginCode.trim().length()>0)
{
System.out.println(" Inside PendingPurcOrder for getPendingPOSummary Method Data Soruc Name ="+dataSourceName+" loginCode is =" + loginCode);
/*conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;*/
/*add new code for connection DB on dated:14062016 by Nikhil*/
conn = getConnection();
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
/*to get P Order summary data */
sql = " select sum(tot_amt) as process_orders,count(1) as no_of_po "
+" from porder where ORD_DATE >= (SELECT ADD_MONTHS(SYSDATE,-5) FROM DUAL ) "
......@@ -454,7 +450,7 @@ public class PendingPurcOrder extends ValidatorEJB implements PendingPurcOrderRe
}
/*check null functionallity for required component*/
//check null functionallity for required component
private double checkDoubleNull(String str)
{
if(str == null || str.trim().length() == 0 || str.trim().equalsIgnoreCase("null"))
......
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