AbhishekSrivastava - Saturday, April 16, 2016 1:37 AM:
Hello Guys,
I use below code to get total man hours of employee but it will take too much time too respond, So is there any way to get report on less time.
Report Query
<Item type="TimeSheet" action="get" select=""/>
StyleSheet =
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:aras="http://www.aras-corp.com" version="1.0">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="/">
<html>
<head/>
<style type="text/css" userData="Global">
table {empty-cells:show; border-collapse:collapse;}
th {font-family:helvetica; font-size:8pt; padding:2px; border:1px #000000 solid; background-color:#CCCCCC; text-transform:capitalize;}
td {font-family:helvetica; font-size:8pt; padding:2px; border:1px #000000 solid;}
td.noBorder {font-family:helvetica; font-size:8pt; padding:2px; border-width:0;}
.cellHeader {background-color:#CCCCCC;border-top:1px #000000 solid;border-right:1px #000000 solid;border-bottom:1px #000000 solid;padding:2px;text-align:center;
text-transform:capitalize;text-align:left;font-family:helvetica;font-weight:bold;font-size:8pt;}
table
{
border-collapse:collapse;
}
table, td, th
{
border:1px solid black;
}
</style>
<body bgcolor="#E6E6FA">
<table>
<body topmargin="50" leftmargin="50">
<table border="0" cellspacing="0" cellpadding="0" width="1000">
<tr valign="top">
<td class="cellHeader" uniqueID="ms__id13" align="left" colspan="" rowspan="" height="" width="30%" style="font-family:helvetica;font-size:12pt;padding:2px;">User Name</td>
<td class="cellHeader" uniqueID="ms__id13" align="left" colspan="" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">IEC</td>
<td class="cellHeader" colspan="" uniqueID="ms__id14" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">EoS</td>
<td class="cellHeader" colspan="" uniqueID="ms__id15" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">CAE</td>
<td class="cellHeader" colspan="" uniqueID="ms__id16" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">STP</td>
<td class="cellHeader" colspan="" uniqueID="ms__id16" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">RP</td>
<td class="cellHeader" uniqueID="ms__id13" align="left" colspan="" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">STM</td>
<td class="cellHeader" colspan="" uniqueID="ms__id14" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">BPM</td>
<td class="cellHeader" colspan="" uniqueID="ms__id15" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">JGF</td>
<td class="cellHeader" colspan="" uniqueID="ms__id16" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">MC</td>
<td class="cellHeader" colspan="" uniqueID="ms__id16" align="left" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">MIND</td>
<td class="cellHeader" uniqueID="ms__id13" align="left" colspan="" rowspan="" height="" width="10%" style="font-family:helvetica;font-size:12pt;padding:2px;">Total</td>
</tr>
<tr>
<td class="cellHeader" uniqueID="ms__id13" align="left" colspan="" rowspan="" height="" width="30%" style="font-family:helvetica;font-size:12pt;padding:2px;">Ashis Kumar Naik</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id1">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='IEC' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me1" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id1').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me1') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id2">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='EoS' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me2" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id2').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me2') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id3">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='CAE' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me3" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id3').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me3') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id4">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='STP' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me4" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id4').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me4') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id5">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='RP' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me5" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id5').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me5') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id6">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='STM' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me6" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id6').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me6') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id7">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='BPM' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me7" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id7').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me7') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id8">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='JGF' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me8" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id8').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me8') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id9">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='MC' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me9" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id9').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me9') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id10">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and department='MIND' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me10" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id10').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me10') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
<td width="10%">
<table border="0" cellspacing="0" cellpadding="0" width="67" id="id11">
<xsl:for-each select="//Item[@type='TimeSheet']">
<variable name="effDate" select="created_on" as="xs:date"/>
<xsl:variable name="year" select="substring(created_on,1,4)"/>
<xsl:variable name="month" select="substring(created_on,6,2)"/>
<xsl:variable name="day" select="substring(created_on,9,2)"/>
<xsl:if test="$month='03' and employee_name='Ashis Kumar Naik'">
<tr valign="top" style="display: none;">
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="project_number"/>
</td>
<td class="cellSolidRightBottom" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="name"/>
</td>
<td class="count-me11" style="font-family:helvetica; font-size:8pt; padding:2px;" uniqueID="ms__id17">
<xsl:value-of select="man_hours"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td colspan="2" align="center">
<script language="javascript" type="text/javascript">
var tds = document.getElementById('id11').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me11') {
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.write(sum);
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
<script src="../../javascript/PopupMenu.js"/>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Thank You
Abhishek Srivastava
kentonv - Friday, June 3, 2016 11:19 AM:
For any relatively complicated report calculations, I would leverage the report method, and add your totals using a server method prior to translating in the report stylesheet.
In other words, create a method that loops through the query results you desire to be reported, then set the property like: setProperty("total_man_hours",ResultingSum).
Then, attach the method to the report method property.
In your xslt you now need only do a simple <xsl:value-of select="total_man_hours"/>