Commit c07dbf31 authored by sbalip's avatar sbalip

meet varience report related changes

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182947 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8fad2718
...@@ -70,9 +70,9 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo ...@@ -70,9 +70,9 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo
String query = ""; //$NON-NLS-1$ String query = ""; //$NON-NLS-1$
if( "ADMIN".equalsIgnoreCase( profileId.trim() ) ) if( "ADMIN".equalsIgnoreCase( profileId.trim() ) )
{ {
query = "select s.tran_id, s.event_date, s.event_type, sr.station_type, s.strg_code, s.strg_name, s.sales_pers, c.addr1 || ' ' || c.addr2 || ' ' || c.addr3 || ', ' || city as Address, c.geo_pos, s.chg_geopos "+ query = "select s.event_date as EVENT_DATE, f.descr as EVENT, sr.station_type as STATION_TYPE, s.strg_code as CUSTOMER_CODE, c.first_name || ' ' || c.last_name as CUSTOMER_NAME, s.sales_pers as SP_CODE, sp.sp_name as SP_NAME, c.addr1 || ' ' || c.addr2 || ' ' || c.addr3 || ', ' || c.city as ACTUAL_CUSTOMER_ADDRESS, c.geo_pos as GEO_POS, s.chg_geopos as CHG_GEOPOS "+
"from strg_meet s left join strg_customer c on s.strg_code=c.sc_code, sprs_route sr "+ "from strg_meet s left join strg_customer c on s.strg_code=c.sc_code, sprs_route sr, fieldactivity f, sales_pers sp "+
"where s.event_date between ? and ? and s.event_type='FW' and s.locality_code=sr.locality_code and s.sales_pers=sr.sprs_code order by s.event_date"; "where s.event_date between ? and ? and s.event_type='FW' and s.locality_code=sr.locality_code and s.sales_pers=sr.sprs_code and s.event_type = f.activity_code and s.sales_pers = sp.sales_pers order by s.event_date";
mStatement = mConnection.prepareStatement(query); mStatement = mConnection.prepareStatement(query);
mStatement.setDate(1, java.sql.Date.valueOf(fromDateStr) ); mStatement.setDate(1, java.sql.Date.valueOf(fromDateStr) );
mStatement.setDate(2, java.sql.Date.valueOf(toDateStr) ); mStatement.setDate(2, java.sql.Date.valueOf(toDateStr) );
...@@ -99,8 +99,8 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo ...@@ -99,8 +99,8 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo
if( subordinateUsers != null && !subordinateUsers.isEmpty() ) if( subordinateUsers != null && !subordinateUsers.isEmpty() )
{ {
System.out.println("subordinateUsers:::["+subordinateUsers+"]"); System.out.println("subordinateUsers:::["+subordinateUsers+"]");
query = "select s.tran_id, s.event_date, s.event_type, sr.station_type, s.strg_code, s.strg_name, s.sales_pers, c.addr1 || ' ' || c.addr2 || ' ' || c.addr3 || ', ' || city as Address, c.geo_pos, s.chg_geopos "+ query = "select s.event_date as EVENT_DATE, f.descr as EVENT, sr.station_type as STATION_TYPE, s.strg_code as CUSTOMER_CODE, c.first_name || ' ' || c.last_name as CUSTOMER_NAME, s.sales_pers as SP_CODE, sp.sp_name as SP_NAME, c.addr1 || ' ' || c.addr2 || ' ' || c.addr3 || ', ' || c.city as ACTUAL_CUSTOMER_ADDRESS, c.geo_pos as GEO_POS, s.chg_geopos as CHG_GEOPOS "+
"from strg_meet s left join strg_customer c on s.strg_code=c.sc_code, sprs_route sr "+ "from strg_meet s left join strg_customer c on s.strg_code=c.sc_code, sprs_route sr, fieldactivity f, sales_pers sp "+
"where s.event_date between ? and ? and s.sales_pers IN "; "where s.event_date between ? and ? and s.sales_pers IN ";
String queryIN = "("; String queryIN = "(";
for( int i = 0; i < subordinateUsers.size(); i++) for( int i = 0; i < subordinateUsers.size(); i++)
...@@ -115,21 +115,21 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo ...@@ -115,21 +115,21 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo
} }
} }
queryIN += ")"; queryIN += ")";
query += queryIN + " and s.event_type='FW' and s.locality_code=sr.locality_code and s.sales_pers=sr.sprs_code order by s.event_date"; query += queryIN + " and s.event_type='FW' and s.locality_code=sr.locality_code and s.sales_pers=sr.sprs_code and s.event_type = f.activity_code and s.sales_pers = sp.sales_pers order by s.event_date";
mStatement = mConnection.prepareStatement(query); mStatement = mConnection.prepareStatement(query);
mStatement.setDate(1, java.sql.Date.valueOf(fromDateStr) ); mStatement.setDate(1, java.sql.Date.valueOf(fromDateStr) );
mStatement.setDate(2, java.sql.Date.valueOf(toDateStr) ); mStatement.setDate(2, java.sql.Date.valueOf(toDateStr) );
} }
} }
mResultSet = mStatement.executeQuery(); mResultSet = mStatement.executeQuery();
ResultSetMetaData rsmd = mResultSet.getMetaData(); //ResultSetMetaData rsmd = mResultSet.getMetaData();
int colCount = rsmd.getColumnCount(); //int colCount = rsmd.getColumnCount();
while (mResultSet.next()) while (mResultSet.next())
{ {
String geo_pos = ""; String geo_pos = "";
String chg_geopos = ""; String chg_geopos = "";
JSONObject rowDataVar = new JSONObject(); JSONObject rowDataVar = new JSONObject();
for (int i = 1; i <= colCount; i++) /*for (int i = 1; i <= colCount; i++)
{ {
String columnName = rsmd.getColumnName(i); String columnName = rsmd.getColumnName(i);
System.out.println("columnName in loop:::"+columnName); System.out.println("columnName in loop:::"+columnName);
...@@ -144,7 +144,17 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo ...@@ -144,7 +144,17 @@ public class VarianceReportMR extends ValidatorEJB implements VarianceReportMRLo
chg_geopos = value; chg_geopos = value;
} }
rowDataVar.put(columnName, value); rowDataVar.put(columnName, value);
} }*/
rowDataVar.put("EVENT_DATE", e12genericUtil.getValidDateString( E12GenericUtility.checkNull(mResultSet.getDate("EVENT_DATE").toString()), e12genericUtil.getDBDateFormat(), e12genericUtil.getApplDateFormat()) );
rowDataVar.put("EVENT", E12GenericUtility.checkNull(mResultSet.getString("EVENT")));
rowDataVar.put("STATION_TYPE", E12GenericUtility.checkNull(mResultSet.getString("STATION_TYPE")));
rowDataVar.put("CUSTOMER_CODE", E12GenericUtility.checkNull(mResultSet.getString("CUSTOMER_CODE")));
rowDataVar.put("CUSTOMER_NAME", E12GenericUtility.checkNull(mResultSet.getString("CUSTOMER_NAME")));
rowDataVar.put("SP_CODE", E12GenericUtility.checkNull(mResultSet.getString("SP_CODE")));
rowDataVar.put("SP_NAME", E12GenericUtility.checkNull(mResultSet.getString("SP_NAME")));
rowDataVar.put("ACTUAL_CUSTOMER_ADDRESS", E12GenericUtility.checkNull(mResultSet.getString("ACTUAL_CUSTOMER_ADDRESS")));
geo_pos = E12GenericUtility.checkNull(mResultSet.getString("GEO_POS"));
chg_geopos = E12GenericUtility.checkNull(mResultSet.getString("CHG_GEOPOS"));
if( geo_pos.trim().length() > 0 && chg_geopos.trim().length() > 0 ) if( geo_pos.trim().length() > 0 && chg_geopos.trim().length() > 0 )
{ {
double lat1 = Double.parseDouble( geo_pos.split(",")[0] ); double lat1 = Double.parseDouble( geo_pos.split(",")[0] );
......
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