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
rs = pstmt.executeQuery();
while (rs.next())
{
userID = checkNull(rs.getString("user_id"));
userID = checkNull(rs.getString("user_id").trim());
uri = checkNull(rs.getString("uri"));
finalURI = CommonConstants.TOMCAT_HOME+uri+"&userID="+userID;
System.out.println("direct uri from table ="+ uri);
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);
}
......@@ -104,9 +104,9 @@ public class ProductionVsBudgetReportSchedule implements Schedule
{
try
{
System.out.println("run on browser through window ");
System.out.println("run on browser(IE) through window machine");
desktop.browse(new URI(resourcePath));
Thread.sleep(2500);
Thread.sleep(120000);
System.out.println("End run on browser through window ");
}
catch (Exception e)
......@@ -117,14 +117,14 @@ public class ProductionVsBudgetReportSchedule implements Schedule
//Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler" + resourcePath);
//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*/
if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0)
{
//browserPathForLinex ="/usr/lib/firefox/firefox";
browserPathForLinex ="/usr/lib/firefox/firefox";
//browserPathForLinex ="/usr/lib/firefox/firefox";//this is my PC firefox
browserPathForLinex ="/usr/bin/firefox";
for (String resourcePath : sendFinalURIList)
{
callURL(browserPathForLinex,resourcePath); //call synchronized method
......@@ -174,7 +174,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule
int second = (int)(System.currentTimeMillis() / 1000) % 60 ;
System.out.println("View for Time when next URL are comming==="+second);
Runtime.getRuntime().exec(new String[] {browserPath, resourcePath});
Thread.sleep(35000);
Thread.sleep(120000);
System.out.println("In Linex12");
}catch(Exception e){System.out.println("Exception Inside callURL by synchronization method "+e.getMessage());}
}
......
......@@ -82,17 +82,8 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
cal = Calendar.getInstance();
// cal.add(cal.MONTH,-1);
cal.set(Calendar.DATE, cal.getActualMinimum(Calendar.DATE));
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'))";
firstDateofMonth = sdf.format(cal.getTime());
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);
rs = pstmt.executeQuery();
xmlDataForGeo = new StringBuffer("<?xml version=\"1.0\"?><Root>");
......@@ -111,16 +102,8 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
pstmt.close();
rs.close();
pstmt = 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";
rs = 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);
rs = pstmt.executeQuery();
xmlDataForUnit = new StringBuffer("<?xml version=\"1.0\"?><Root>");
......@@ -235,13 +218,11 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
// 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);
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";
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";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, frmDate);
pstmt.setString(2, toDate);
// End of setter statement
rs = pstmt.executeQuery();
xmlData = new StringBuffer("<?xml version=\"1.0\"?><Root>");
xmlData.append("<Detail>");
......@@ -256,7 +237,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
count++;
geoLocation = checkNull(rs.getString("geo_loc"));
unit = checkNull(rs.getString("unit__form"));
unit = checkNull(rs.getString("unit__form"));
if (count > 1 && ((!previousUnit.equals(unit)) || (!geoLocationPrevious.equals(geoLocation))))
{
......@@ -631,10 +612,10 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
keyList.add(entry.getKey());
valueList.add(entry.getValue());
}
int keyListSize=keyList.size();
int mod= keyListSize%3;
int devide=keyListSize/3;
int prntTblNo=mod+devide;
int keyListSize =keyList.size();
int mod =keyListSize%3;
int devide =keyListSize/3;
int prntTblNo =mod+devide;
int parentCnt=0;
int childTblCnt=0;
PdfPTable parentTable=null;
......@@ -659,14 +640,14 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
childtable = new PdfPTable(1);
childtable.setWidthPercentage(90);
imageName=keyList.get(imageCounter);
gridDataList=valueList.get(imageCounter);
imageCounter++;
imageName =keyList.get(imageCounter);
gridDataList =valueList.get(imageCounter);
//Add by Birendra Pandey
imageCounter++;
imgFilePath = exportImagePath+imageName+userID+".png";
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);
//code for images deleted
existImgFile= new File(imgFilePath);
......@@ -752,7 +733,8 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
cell = new PdfPCell(new Paragraph(gridDataList.get(6),font));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBackgroundColor(Color.YELLOW);
table.addCell(cell);
table.addCell(cell);
//2
childtable.addCell(table);
cell = new PdfPCell(childtable);
cell.setBorder(Rectangle.NO_BORDER);
......@@ -779,8 +761,8 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
file.close();
System.out.println("PDF Created succesfully");
conn = connDriver.getConnectDB("DriverITM");
connDriver =null;
conn = connDriver.getConnectDB("DriverITM");
connDriver =null;
toMailId ="";
ccMailId ="";
bccAddress ="";
......@@ -803,8 +785,8 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
//toMailId ="sachin.shinde57@gmail.com";
System.out.println("Export Pdf path is ="+pdfFileName);
attachFile = new File(pdfFileName);
if(attachFile.exists())
attachFile = new File(pdfFileName);
if(attachFile.exists() && attachFile.length()>0)
{
mailInfo =new ArrayList<String>();
mailInfo.add(toMailId);
......@@ -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("</MAILINFO>");
commInfo.append("</ROOT>");
EMail email = new EMail();
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