<%@
page language="java"
import="org.pentaho.core.system.PentahoSystem,
org.pentaho.core.session.IPentahoSession,
org.pentaho.core.util.XmlHelper,
org.pentaho.messages.Messages,
org.pentaho.core.util.UIUtil,
org.pentaho.core.util.IUITemplater,
org.pentaho.messages.util.LocaleHelper,
org.pentaho.util.VersionHelper,
org.pentaho.ui.component.INavigationComponent,
org.pentaho.ui.component.NavigationComponentFactory,
org.pentaho.ui.component.HtmlComponent,
org.pentaho.core.ui.SimpleUrlFactory,
org.pentaho.core.solution.SimpleParameterProvider,
org.pentaho.ui.ChartHelper,
org.dom4j.*,
org.pentaho.core.solution.ActionResource,
org.pentaho.core.solution.IActionResource,
ADD.java.Clt,
java.io.*,
java.util.*,
java.text.*"
%><%
/*
* Copyright 2006 Pentaho Corporation. All rights reserved.
* This software was developed by Pentaho Corporation and is provided under the terms
* of the Mozilla Public License, Version 1.1, or any later version. You may not use
* this file except in compliance with the license. If you need a copy of the license,
* please go to
http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
* BI Platform. The Initial Developer is Pentaho Corporation.
*
* Software distributed under the Mozilla Public License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
* the license for the specific language governing your rights and limitations.
*
* @created Jul 23, 2005
* @author James Dixon
*
*/
response.setCharacterEncoding(LocaleHelper.getSystemEncoding());
String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
String path = request.getContextPath();
IPentahoSession userSession = UIUtil.getPentahoSession( request );
String intro = "";
String footer = "";
IUITemplater templater = PentahoSystem.getUITemplater( userSession );
if( templater != null )
{
String sections[] = templater.breakTemplate( "template-home.html", "", userSession ); //$NON-NLS-1$ //$NON-NLS-2$
if( sections != null && sections.length > 0 )
{
intro = sections[0];
}
if( sections != null && sections.length > 1 )
{
footer = sections[1];
}
} else {
intro = Messages.getString( "UI.ERROR_0002_BAD_TEMPLATE_OBJECT" );
}
intro = intro.replaceFirst( "\\{welcome\\}", Messages.getString("UI.USER_WELCOME") ); //$NON-NLS-1$
%>
<%= intro %>
<p><font name=verdana color=RED size="2"><B>
<%
int Exist_stateV = 0;
int Exist_stateL = 0;
int Exist_stateB = 0;
int EXENotExists=0;
int count=0;
int Valuecnt=0;
Map map = System.getenv();
Set keys = map.keySet();
Iterator iterator = keys.iterator();
String key =null;
String value = null;
out.println("<br>");
out.println("<div align=center>");
while (iterator.hasNext())
{
key = (String) iterator.next();
if (key.toLowerCase().equals("bicpath"))
{
count=count+1;
value = (String) map.get(key);
break;
}
}
if (count == 1)
{
if (value == null)
{ Valuecnt=0;
//out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println("Error System Environment Variable BICPATH VALUE IS NULL");
//out.println("</marquee>");
//out.println("<br>");
}
if (value.length() == 0)
{ Valuecnt=0;
//out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println("Error System Environment Variable BICPATH VALUE NOT PRESENT");
//out.println("</marquee>");
//out.println("<br>");
}
boolean exists = (new File(value)).exists();
if (exists)
{ //out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
// out.println("Error System Environment Variable BICPATH VALUE Dir Exists");
//out.println("</marquee>");
Valuecnt=1;
}
else
{ //out.println("Does not Exists");
Valuecnt=0;
}
}
if (count==0)
{ //out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println("Error System Environment Variable BICPATH Not Found");
//out.println("</marquee>");
out.println("<br>");
}
if (Valuecnt==0)
{ //out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println("Error System Environment Variable BICPATH [ "+value+" ] Directory Doesn't Exist");
//out.println("</marquee>");
out.println("<br>");
}
out.println("</B>");
if (count==1)
{
if (Valuecnt==1)
{
File EXEfile = new File(value +"\\DexT.exe");
if (EXEfile.exists())
{
EXENotExists=1;
}
}
}
//File file=new File("F:\\TallyBIC\\Transformations\\Export\\MergedVouchers.txt");
File file = new File(value +"\\Export\\MergedVouchers.txt");
long modifiedtime= file.lastModified();
Date dm=new Date(modifiedtime);
if(file.exists())
{
Exist_stateV = 1;
//-- out.println("<br>");
out.println("<div align=center>");
// out.println("The Data For Vouchers was Last Refreshed on [ " +dm+" ]");
}
else
{
Exist_stateV = 0;
//out.println(" The Data For Vouchers Does not Exist at [ " +file+" ]");
}
File fileL=new File(value +"\\Export\\MergedLedgers.txt");
long modifiedtimeL= fileL.lastModified();
Date dmL=new Date(modifiedtimeL);
if(fileL.exists())
{
Exist_stateL = 1;
// out.println(" The Data For Ledgers was Last Refreshed on [ " +dmL+" ]");
}
else
{
Exist_stateL = 0;
//out.println(" The Data For Ledgers Does not Exist at [ " +fileL+" ]");
}
File fileB=new File(value +"\\Export\\MergedBills.txt");
long modifiedtimeB= fileB.lastModified();
Date dmB=new Date(modifiedtimeB);
if(fileB.exists())
{
Exist_stateB = 1;
// out.println("<br>");
// out.println(" The Data For Bills was Last Refreshed on [ " +dmB+" ]");
}
else
{ Exist_stateB = 0;
// out.println("<br>");
// out.println(" The Data For Bills Does not Exist at [ " +fileB+" ]");
}
if (Exist_stateV == 1 && Exist_stateL == 1 && Exist_stateB == 1)
{ //out.println("<br>");
// out.println("<B>");
// out.println("<div align=Left>");
//out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
// out.println(" The Data was Last Refreshed on [ " +dmB+" ]");
//out.println("</marquee>");
//out.println("</B>");
//-- out.println("<br>");
}
else
{ out.println("<B>");
//out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println("<div align=Left>");
//-- out.println("Error Status:-Files Do not Exist at " + value + "\\Export Directory");
//out.println("</marquee>");
out.println("</B>");
//-- out.println("<br>");
if(Exist_stateV == 0)
{
// out.println("<br>");
out.println("<div align=Left>");
//out.println("<marquee WIDTH=20% SCROLLDELAY=175 DIRECTION=LEFT BGCOLOR=RED>");
//-- out.println(" The Data For Vouchers Does not Exist at [ " +file+" ]");
//out.println("</marquee>");
}
if(Exist_stateL == 0)
{
//-- out.println("<br>");
out.println("<div align=Left>");
//--- out.println(" The Data For Ledgers Does not Exist at [ " +fileL+" ]");
}
if(Exist_stateB == 0)
{
// out.println("<br>");
out.println("<div align=Left>");
//--- out.println(" The Data For Bills Does not Exist at [ " +fileB+" ]");
}
}
File Histfile = new File(value +"\\Export\\CurrentYr\\ALLCompanies_MergedHCVch.txt");
long Histmodifiedtime= Histfile.lastModified();
Date Histdm=new Date(Histmodifiedtime);
File HistfileL = new File(value +"\\Export\\CurrentYr\\ALLCompanies_MergedHCLed.txt");
long HistmodifiedtimeL= HistfileL.lastModified();
Date HistdmL=new Date(HistmodifiedtimeL);
File HistfileB = new File(value +"\\Export\\CurrentYr\\ALLCompanies_MergedHCStocks.txt");
long HistmodifiedtimeB= HistfileB.lastModified();
Date HistdmB=new Date(HistmodifiedtimeB);
int HExist_stateV = 0;
int HExist_stateL = 0;
int HExist_stateB = 0;
if(Histfile.exists())
{
HExist_stateV = 1;
}
else
{
HExist_stateV = 0;
}
if(HistfileL.exists())
{
HExist_stateL = 1;
}
else
{
HExist_stateL = 0;
}
if(HistfileB.exists())
{
HExist_stateB = 1;
}
else
{
HExist_stateB = 0;
}
if (HExist_stateV == 1 && HExist_stateL == 1 && HExist_stateB == 1)
{ out.println("<br>");
out.println("<div align=Left>");
out.println("<B>");
//out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println(" The Data was Last Refreshed on [ " +HistdmB+" ]");
//out.println("</marquee>");
out.println("</B>");
out.println("<br>");
}
else
{
out.println("<B>");
out.println("<div align=Left>");
//out.println("<marquee WIDTH=30% SCROLLDELAY=10 DIRECTION=LEFT Height=20>");
out.println("Error Status:- No Data available at " + value + "\\Export\\CurrentYr Directory");
out.println("<br>");
out.println("Click Refresh Data Button To run EXE ");
//out.println("</marquee>");
out.println("</B>");
// out.println("<br>");
if(HExist_stateV == 0)
{
// out.println("<br>");
out.println("<div align=Left>");
//out.println("<marquee WIDTH=20% SCROLLDELAY=175 DIRECTION=LEFT BGCOLOR=RED>");
//-- out.println(" The History Data For Vouchers Does not Exist at [ " +Histfile+" ]");
//out.println("</marquee>");
}
if(HExist_stateL == 0)
{
//out.println("<br>");
out.println("<div align=Left>");
//--out.println(" The History Data For Ledgers Does not Exist at [ " +HistfileL+" ]");
}
if(HExist_stateB == 0)
{
//out.println("<br>");
out.println("<div align=Left>");
//--out.println(" The History Data For Bills Does not Exist at [ " +HistfileB+" ]");
}
}
%>
</font>
</p>
<FORM NAME="form1" METHOD="POST">
<div align="center">
<p><font color=#8000 size="2">
<br/>
Click "Refresh Data" Button For Live Data</font>
<input type="hidden" name="username" value="aa" size="3"></p>
<p><input type="submit" value="Refresh Data" name="B1"></p>
</FORM>
<%
// See if we have a 'territory' parameter
String territory = request.getParameter("territory");
// See if we have a 'productline' parameter
String productline = request.getParameter("productline");
// Create the title for the top of the page
String title = "Top Ten Customers";
if( territory == null && productline != null) {
title = "Top Ten for " + productline;
}
else if ( territory != null && productline == null) {
title = "Top Ten for " + territory;
}
else if ( territory == null && productline == null) {
title = "Top Ten Customers";
}
else {
title = "Top Ten for " + territory + ", " + productline;
}
String pie1 = "";
String pie2 = "";
String chart = "";
SimpleParameterProvider parameters = new SimpleParameterProvider();
parameters.setParameter( "drill-url", "Home?territory={territory}" );
parameters.setParameter( "inner-param", "territory"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-width", "375"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-height", "275"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer content = new StringBuffer();
ArrayList messages = new ArrayList();
ChartHelper.doPieChart( "samples", "steel-wheels/homeDashboard", "territory.widget.xml", parameters, content, userSession, messages, null );
pie1 = content.toString();
parameters = new SimpleParameterProvider();
if( territory == null ) {
parameters.setParameter( "drill-url", "Home?productline={productline}" );
} else {
parameters.setParameter( "drill-url", "Home?territory="+territory+"&productline={productline}" );
}
parameters.setParameter( "territory", territory );
parameters.setParameter( "productline", productline );
parameters.setParameter( "inner-param", "territory"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "inner-param", "productline"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-width", "375"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-height", "275"); //$NON-NLS-1$ //$NON-NLS-2$
content = new StringBuffer();
messages = new ArrayList();
ChartHelper.doPieChart( "samples", "steel-wheels/homeDashboard", "productline.widget.xml", parameters, content, userSession, messages, null );
pie2 = content.toString();
parameters = new SimpleParameterProvider();
parameters.setParameter( "image-width", "500"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "image-height", "525"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "territory", territory );
parameters.setParameter( "productline", productline );
parameters.setParameter( "inner-param", "territory"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.setParameter( "inner-param", "productline"); //$NON-NLS-1$ //$NON-NLS-2$
content = new StringBuffer();
messages = new ArrayList();
ChartHelper.doChart( "samples/steel-wheels", "homeDashboard", "customer.widget.xml", parameters, content, userSession, messages, null );
chart = content.toString();
%>
<center>
<table style="width:1000" border="0">
<tr>
<!-- td>
<span class="welcome_message"><%= Messages.getString("UI.USER_WELCOME") %></span>
</td> -->
<td colspan='2' class='content_pagehead'>
<%//= Messages.getString( "UI.USER_HOME_INTRO" ) %>
</td>
</tr>
</table>
<table style="text-align: left; border:1px solid #808080" cellpadding="0" cellspacing="0" border="0" >
<tr>
<td valign="top" align="center"><%= pie1 %></td>
<td rowspan="2" valign="top">
<%= title %>
<%= chart %>
</td>
</tr>
<tr>
<td valign="top" align="center">
<%= pie2 %>
</td>
</tr>
</table>
<table width="1000" style="padding: 5px 5px 5px 5px">
<!--
<tr>
<td width="500" class="content_header"><%= Messages.getString( "UI.USER_LINKS" ) %></td>
<td width="500" class="content_header"><%= Messages.getString( "UI.USER_WHATS_NEW") %></td>
</tr>
-->
<!-- <tr>
<td valign="top" class="content_container3" style="text-align:left"> -->
<%
messages = new ArrayList();
HtmlComponent html = new HtmlComponent( HtmlComponent.TYPE_URL, "http://www.pentaho.org/demo/links.htm", Messages.getString("UI.USER_OFFLINE"), null, messages);
html.validate( userSession, null );
%>
<%//= html.getContent( "text/html" ) %>
<!-- </td>
<td valign="top" class="content_container3" style="text-align:left"> -->
<%
messages = new ArrayList();
//html = new HtmlComponent( HtmlComponent.TYPE_URL, "http://www.pentaho.org/demo/news1.htm", Messages.getString("UI.USER_OFFLINE"), null, messages);
//html.validate( userSession, null );
%>
<% ADD.java.Clt dext = new ADD.java.Clt();%>
<%! private String accessCount=null; %>
<%! private String Initial=null; %>
<%! private String Count=new String("aa"); %>
<%! private int Error_Status=0; %>
<%! private int ES; %>
<p><font name=verdana color=white size="2"><B>
<%= accessCount=request.getParameter("username") %>
</p>
<% if(accessCount!=null) { %>
<%=accessCount=request.getParameter("Initial")%>
<% Error_Status=dext.sum();
System.out.print(Error_Status);
if (EXENotExists==0)
{
%>
<script type="text/javascript">
alert("DexT.exe does not Exist ");
</script>
<%
}
%>
<%
if (Valuecnt!=0 && EXENotExists==1)
{
%>
<script type="text/javascript">
alert("Data Extraction Process Completed");
</script>
<%
}
%>
<% } else {
ES=0;
%>
<script type="text/javascript">
<!-- alert(" Click (Refresh Data) Button For Live Data"); -->
</script>
<%
}
%>
<%//=html.getContent( "text/html" ) %>
<!-- </td>
</tr> -->
</table>
</center>
<%= footer %>