Commit b70fc24a authored by bpandey's avatar bpandey

changes as per client requirement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96017 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b1764bf9
...@@ -64,12 +64,12 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -64,12 +64,12 @@ public class ProductionVsBudgetReportSchedule implements Schedule
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
userID = checkNull(rs.getString("user_id")); userID = checkNull(rs.getString("user_id").trim());
uri = checkNull(rs.getString("uri")); uri = checkNull(rs.getString("uri"));
finalURI = CommonConstants.TOMCAT_HOME+uri+"&userID="+userID; finalURI = CommonConstants.TOMCAT_HOME+uri+"&userID="+userID;
System.out.println("direct uri from table ="+ uri); System.out.println("direct uri from table ="+ uri);
System.out.println("User id is =" + userID); System.out.println("User id is =" + userID);
System.out.println("modify url is =" + finalURI); System.out.println("Final url appended user id in URL =" + finalURI);
sendFinalURIList.add(finalURI); sendFinalURIList.add(finalURI);
} }
...@@ -104,9 +104,9 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -104,9 +104,9 @@ public class ProductionVsBudgetReportSchedule implements Schedule
{ {
try try
{ {
System.out.println("run on browser through window "); System.out.println("run on browser(IE) through window machine");
desktop.browse(new URI(resourcePath)); desktop.browse(new URI(resourcePath));
Thread.sleep(2500); Thread.sleep(120000);
System.out.println("End run on browser through window "); System.out.println("End run on browser through window ");
} }
catch (Exception e) catch (Exception e)
...@@ -117,14 +117,14 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -117,14 +117,14 @@ public class ProductionVsBudgetReportSchedule implements Schedule
//Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler" + resourcePath); //Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler" + resourcePath);
//Thread.sleep(25000L); //Thread.sleep(25000L);
} }
System.out.println("End of Window Section part execution"); System.out.println("End of Window Machine section part execution");
} }
/* Ended Added new code for windows palform*/ /* Ended Added new code for windows palform*/
if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0)
{ {
//browserPathForLinex ="/usr/lib/firefox/firefox"; //browserPathForLinex ="/usr/lib/firefox/firefox";//this is my PC firefox
browserPathForLinex ="/usr/lib/firefox/firefox"; browserPathForLinex ="/usr/bin/firefox";
for (String resourcePath : sendFinalURIList) for (String resourcePath : sendFinalURIList)
{ {
callURL(browserPathForLinex,resourcePath); //call synchronized method callURL(browserPathForLinex,resourcePath); //call synchronized method
...@@ -174,7 +174,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -174,7 +174,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule
int second = (int)(System.currentTimeMillis() / 1000) % 60 ; int second = (int)(System.currentTimeMillis() / 1000) % 60 ;
System.out.println("View for Time when next URL are comming==="+second); System.out.println("View for Time when next URL are comming==="+second);
Runtime.getRuntime().exec(new String[] {browserPath, resourcePath}); Runtime.getRuntime().exec(new String[] {browserPath, resourcePath});
Thread.sleep(35000); Thread.sleep(120000);
System.out.println("In Linex12"); System.out.println("In Linex12");
}catch(Exception e){System.out.println("Exception Inside callURL by synchronization method "+e.getMessage());} }catch(Exception e){System.out.println("Exception Inside callURL by synchronization method "+e.getMessage());}
} }
......
...@@ -83,16 +83,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -83,16 +83,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
// cal.add(cal.MONTH,-1); // cal.add(cal.MONTH,-1);
cal.set(Calendar.DATE, cal.getActualMinimum(Calendar.DATE)); cal.set(Calendar.DATE, cal.getActualMinimum(Calendar.DATE));
firstDateofMonth = sdf.format(cal.getTime()); firstDateofMonth = sdf.format(cal.getTime());
// This will generated geoLocation droup down changes on dated
// 28/11/2013
// sql(V.1)
// ="select fld_value, descr from gencodes where FLD_NAME ='GEO_LOC' and mod_name='X' ";
// sql(v.2)
// ="select fld_value, descr from gencodes where fld_name = 'GEO_LOC' and mod_name = 'X' and fld_value in (select distinct geo_loc from site where site_code in (select distinct site_code from dwh_production_day_events where tran_date between ? and ? and ref_ser ='W-RCP'))";
sql = "select g.fld_value, g.descr from gencodes g where fld_name = 'GEO_LOC' and mod_name = 'X' and instr((select trim(var_value) from disparm where var_name = 'DWH_SITE_GEO_LOC'),trim(g.fld_value)) >0"; sql = "select g.fld_value, g.descr from gencodes g where fld_name = 'GEO_LOC' and mod_name = 'X' and instr((select trim(var_value) from disparm where var_name = 'DWH_SITE_GEO_LOC'),trim(g.fld_value)) >0";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
xmlDataForGeo = new StringBuffer("<?xml version=\"1.0\"?><Root>"); xmlDataForGeo = new StringBuffer("<?xml version=\"1.0\"?><Root>");
...@@ -112,15 +103,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -112,15 +103,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
rs.close(); rs.close();
pstmt = null; pstmt = null;
rs = null; rs = null;
// End of geoLoaction with unit_form
// coding for gererate unit form drop down
// sql
// ="select distinct(unit__form) from item_type where unit__form is not null";
sql = "select distinct (i.unit__form),u.descr from item_type i ,uom u where i.unit__form=u.unit and i.unit__form is not null"; sql = "select distinct (i.unit__form),u.descr from item_type i ,uom u where i.unit__form=u.unit and i.unit__form is not null";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
xmlDataForUnit = new StringBuffer("<?xml version=\"1.0\"?><Root>"); xmlDataForUnit = new StringBuffer("<?xml version=\"1.0\"?><Root>");
...@@ -235,13 +218,11 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -235,13 +218,11 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
// end of changes // end of changes
System.out.println("select Final initGeoLocation inside in EJB ===" + geoLoc + "selected initUnitForm inside in java ==" + unitForm + "length of List ====" + listDate.size() + "AND Value of ===" + listDate); System.out.println("select Final initGeoLocation inside in EJB ===" + geoLoc + "selected initUnitForm inside in java ==" + unitForm + "length of List ====" + listDate.size() + "AND Value of ===" + listDate);
sql = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty, " + "cum_budqty , sum(day_quantity) over (partition by geo_loc, unit__form order by tran_date) " + "as cur_cumqty from ( select s.GEO_LOC,p.tran_date, t.unit__form, " + "sum(fn_qty_form(p.item_code,p.unit,t.unit__form,i.phy_attrib_6, p.quantity)) " + "as day_quantity, fn_get_pyr_cumqty( to_date(add_months(p.tran_date,-12)),s.geo_loc,t.unit__form ) " + "as pyr_cumqty, fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) " + "as cum_budqty from dwh_production_day_events p, item i, item_type t, " + "site s where p.site_code = s.site_code and p.item_code = i.item_code " + "and i.item_type = t.item_type and p.tran_date >= ? " + "and p.tran_date <= ? " + "and p.ref_type = (case when t.item_type in('AMPOULES','BOTTLES','DROPS','INHALER','POWDER','POUCH','SUSPENSION','TUBE','VIALS','GRANULES') then 'F' when t.item_type in('CAPSULES','TABLETS',' SOFTGELCAP') then 'F' else '' end ) " + "and p.ref_ser = 'W-RCP' and s.geo_loc in(" + geoLoc + ") " + "and t.unit__form in(" + unitForm + ") group by s.GEO_LOC, p.tran_date, t.unit__form ) " + "order by geo_loc, unit__form,tran_date";
sql = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty, " + "cum_budqty , sum(day_quantity) over (partition by geo_loc, unit__form order by tran_date) " + "as cur_cumqty from ( select s.GEO_LOC,p.tran_date, t.unit__form, " + "sum(fn_qty_form(p.item_code,p.unit,t.unit__form,i.phy_attrib_6, p.quantity)) " + "as day_quantity, fn_get_pyr_cumqty( to_date(add_months(p.tran_date,-12)),s.geo_loc,t.unit__form ) " + "as pyr_cumqty, fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) " + "as cum_budqty from dwh_production_day_events p, item i, item_type t, " + "site s where p.site_code = s.site_code and p.item_code = i.item_code " + "and i.item_type = t.item_type and p.tran_date >= ? " + "and p.tran_date <= ? " + "and p.ref_type = (case when t.item_type in('AMPOULES','BOTTLES','DROPS','INHALER','POWDER','POUCH','SUSPENSION','TUBE','VIALS') then 'F' when t.item_type in('CAPSULES','TABLETS',' SOFTGELCAP') then 'F' else '' end ) " + "and p.ref_ser = 'W-RCP' and s.geo_loc in(" + geoLoc + ") " + "and t.unit__form in(" + unitForm + ") group by s.GEO_LOC, p.tran_date, t.unit__form ) " + "order by geo_loc, unit__form,tran_date";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, frmDate); pstmt.setString(1, frmDate);
pstmt.setString(2, toDate); pstmt.setString(2, toDate);
// End of setter statement // End of setter statement
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
xmlData = new StringBuffer("<?xml version=\"1.0\"?><Root>"); xmlData = new StringBuffer("<?xml version=\"1.0\"?><Root>");
xmlData.append("<Detail>"); xmlData.append("<Detail>");
...@@ -631,10 +612,10 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -631,10 +612,10 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
keyList.add(entry.getKey()); keyList.add(entry.getKey());
valueList.add(entry.getValue()); valueList.add(entry.getValue());
} }
int keyListSize=keyList.size(); int keyListSize =keyList.size();
int mod= keyListSize%3; int mod =keyListSize%3;
int devide=keyListSize/3; int devide =keyListSize/3;
int prntTblNo=mod+devide; int prntTblNo =mod+devide;
int parentCnt=0; int parentCnt=0;
int childTblCnt=0; int childTblCnt=0;
PdfPTable parentTable=null; PdfPTable parentTable=null;
...@@ -659,14 +640,14 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -659,14 +640,14 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
childtable = new PdfPTable(1); childtable = new PdfPTable(1);
childtable.setWidthPercentage(90); childtable.setWidthPercentage(90);
imageName=keyList.get(imageCounter); imageName =keyList.get(imageCounter);
gridDataList=valueList.get(imageCounter); gridDataList =valueList.get(imageCounter);
//Add by Birendra Pandey
imageCounter++; imageCounter++;
imgFilePath = exportImagePath+imageName+userID+".png"; imgFilePath = exportImagePath+imageName+userID+".png";
image = Image.getInstance(imgFilePath); image = Image.getInstance(imgFilePath);
System.out.println("Image Present before status=="+imgFilePath); System.out.println("Image name with image path =="+imageName+"imgFilePath=="+imgFilePath);
childtable.addCell(image); childtable.addCell(image);
//code for images deleted //code for images deleted
existImgFile= new File(imgFilePath); existImgFile= new File(imgFilePath);
...@@ -753,6 +734,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -753,6 +734,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBackgroundColor(Color.YELLOW); cell.setBackgroundColor(Color.YELLOW);
table.addCell(cell); table.addCell(cell);
//2
childtable.addCell(table); childtable.addCell(table);
cell = new PdfPCell(childtable); cell = new PdfPCell(childtable);
cell.setBorder(Rectangle.NO_BORDER); cell.setBorder(Rectangle.NO_BORDER);
...@@ -804,7 +786,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -804,7 +786,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
//toMailId ="sachin.shinde57@gmail.com"; //toMailId ="sachin.shinde57@gmail.com";
System.out.println("Export Pdf path is ="+pdfFileName); System.out.println("Export Pdf path is ="+pdfFileName);
attachFile = new File(pdfFileName); attachFile = new File(pdfFileName);
if(attachFile.exists()) if(attachFile.exists() && attachFile.length()>0)
{ {
mailInfo =new ArrayList<String>(); mailInfo =new ArrayList<String>();
mailInfo.add(toMailId); mailInfo.add(toMailId);
...@@ -856,7 +838,6 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production ...@@ -856,7 +838,6 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
commInfo.append("<XML_DATA_FILE_PATH>").append("<![CDATA[" + mailInfo.get(5) + "]]>").append("</XML_DATA_FILE_PATH>"); commInfo.append("<XML_DATA_FILE_PATH>").append("<![CDATA[" + mailInfo.get(5) + "]]>").append("</XML_DATA_FILE_PATH>");
commInfo.append("</MAILINFO>"); commInfo.append("</MAILINFO>");
commInfo.append("</ROOT>"); commInfo.append("</ROOT>");
EMail email = new EMail(); EMail email = new EMail();
try try
{ {
......
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