quadroRiassuntivo.jsp 21.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
<%@page import="it.cedaf.juice.mvc.resources.bundle.BundleHandler"%>
<%@ include file="/project/include.jsp" %>		
	
<%@ page import = "java.util.Calendar" %>
<%@ page import = "java.util.Date" %>
<%@ page import = "java.util.List" %>
<%@ page import = "it.cedaf.commons.DateLib" %>
<%@ page import = "it.cedaf.commons.StringLib" %>
<%@ page import = "it.cedaf.juice.mvc.view.customtags.misc.UrlFunctions" %>
<%@ page import = "it.cedaf.icare.quadririassuntivi.view.dto.*" %>
<%@ page import = "it.cedaf.icare.business.managers.quadririassuntivi.*" %>

<%!
	// Resituisce la posizione in pixel
	// Dalla posizione calcolata matematicamente, devo togliere i pixel occupati dalle barre separatrici e del today
	public int getPosition(Date from, Date date, int cellWidth, int pixelToSubtract, String scale) {
    	return QuadroRiassuntivoJspSupport.getPosition(from, date, cellWidth, pixelToSubtract, scale);
	}
	
	public String getRangeName(int numRange, int numSubRange, boolean shortSubRange, String scale) {
		String name = "&nbsp;";
		if (numSubRange > 1) {
			int numSubRangeMax;
			
			if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
				numSubRangeMax = (shortSubRange) ? 5 : 4;	
				boolean shortName = numSubRange < numSubRangeMax;
				BundleHandler bundle = BundleHandler.getInstance();
				if (numRange >= 0 && numRange <= 11) {
					String index = Integer.toString(numRange + 1);
					name = (shortName) ? bundle.getBundle("LBL_calendario_monthShort" + index, null) : bundle.getBundle("LBL_calendario_month" + index, null);
				}
			
			/** */
			} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
				numSubRangeMax = (shortSubRange) ? 3 : 2;	
				boolean shortName = numSubRange < numSubRangeMax;
				name = "" + numRange;
				if (shortName) {
			    	name = "'" + name.substring(2);	
			    }
				
			/** */	
			} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
			    name = "" + numRange;
			}
		}
		return name;
	}
	
	public String getSubRangeName(int numSubRange, boolean shortSubRange, String scale) {
		String name = "&nbsp;";
		if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
			name = StringLib.EMPTY_STRING + numSubRange;
			
		/** */	
		} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
			BundleHandler bundle = BundleHandler.getInstance();
			if (numSubRange >= 0 && numSubRange <= 11) {
				String index = Integer.toString(numSubRange + 1);
				name = (shortSubRange) ? index : bundle.getBundle("LBL_quadririassuntivi_quadroRiassuntivo_ganttMeseAbbr" + index, null);
			}
			
		/** */
		} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
		    name = numSubRange == 0 ? "I" : "II";
		}
		return name;
	}
	
	// 
	public String getStringValue(String value) {
		return value != null ? value : StringLib.EMPTY_STRING;
	}
	
	// 
	public String getStringValue(Boolean value) {
		if (Boolean.TRUE.equals(value)) {
			return "S";
		} else {
			return "No";
		}
	}
%>

<%
	String scale = (String)pageContext.getAttribute("_scale");		
	
	String img_spacer = UrlFunctions.getResourceUrl("shell", "img/spacer.gif");
	String img_diamond = UrlFunctions.getResourceUrl("quadririassuntivi", "img/diamond.gif");
	String img_plus = UrlFunctions.getResourceUrl("quadririassuntivi", "img/plus.gif");

	// Dto da cui ottengo tutte le info necessarie per costruire il gantt
	RangeInfo rangeInfo = (RangeInfo)request.getAttribute("range_info_dto");
		
	Date from = rangeInfo.getFrom();
	Date to = rangeInfo.getTo();
	Date today = DateLib.today();
	
	Calendar calendarFrom = DateLib.dateToCalendar(from);
	if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
		calendarFrom.add(Calendar.DAY_OF_MONTH, -2);
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
		calendarFrom.add(Calendar.MONTH, -2);
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
	    calendarFrom = DateLib.dateToCalendar(DateLib.getDate(calendarFrom.get(Calendar.YEAR), 0, 1));
	}
	from = calendarFrom.getTime();
	int yearFrom = calendarFrom.get(Calendar.YEAR);
	int monthFrom = calendarFrom.get(Calendar.MONTH);
	int dayFrom = calendarFrom.get(Calendar.DAY_OF_MONTH);
	
	Calendar calendarTo = DateLib.dateToCalendar(to);
	if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
		calendarTo.add(Calendar.DAY_OF_MONTH, 2);
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
		calendarTo.add(Calendar.MONTH, 2);
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
	    calendarTo = DateLib.dateToCalendar(DateLib.getDate(calendarTo.get(Calendar.YEAR), 11, 31));
	}
	to = calendarTo.getTime();
	int yearTo = calendarTo.get(Calendar.YEAR);
	int monthTo = calendarTo.get(Calendar.MONTH);
	int dayTo = calendarTo.get(Calendar.DAY_OF_MONTH);
	
    int diffRange = 0;
    if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
		if (yearFrom == yearTo) {
	        diffRange = monthTo - monthFrom;
	    } else {
	        diffRange = (12 - monthFrom) + monthTo;
	    }
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
	    diffRange = yearTo - yearFrom;
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
	    diffRange = yearTo - yearFrom;
	}

	// parametri relativi ai range da visualizzare
	// 	- firstRange: 	esiste se e solo se si visualizzano piu' di un range. 
	// 					Non e' detto che vengano visualizzati tutti i subrange
	// 	- middleRanges: esiste 1 o piu' range del mezzo, se e solo se si visualizzano piu' di 2 range. 
	// 				  	Vengono visualizzati tutti i subrange
	// 	- lastRange: 	esiste sempre ==> se c'e' un solo range, e' il lastRange.
	// 					Non e' detto che vengano visualizzati tutti i subrange
	int firstRangeSize = 0;
	int firstRangeStart = -1;
	int middleRanges = 0;
	int middleRangeSize = 0;
	if (diffRange > 0) {
		if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
			int daysInMonth = calendarFrom.getActualMaximum(Calendar.DAY_OF_MONTH);
	        firstRangeSize = daysInMonth - dayFrom + 1;
	        firstRangeStart = dayFrom;
	        if (diffRange >= 2) {
				middleRanges = diffRange - 1;
			}
	        for (int i=0; i<middleRanges; i++) {
	            calendarFrom.add(Calendar.MONTH, 1);
	            daysInMonth = calendarFrom.getActualMaximum(Calendar.DAY_OF_MONTH);
	            middleRangeSize += daysInMonth;
	        }
		} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
			firstRangeSize = 12 - monthFrom;
			firstRangeStart = monthFrom;
			if (diffRange >= 2) {
				middleRanges = diffRange - 1;
			}
			middleRangeSize = middleRanges * 12;
			
		} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
			firstRangeSize = 2;
			firstRangeStart = 0;
			middleRanges = diffRange - 1;
			middleRangeSize = middleRanges * 2;
		}
	}
	int lastRangeStart = 0;
	int lastRangeEnd = 0;
	int lastRangeSize;
	if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
		lastRangeStart = 1;
	    if (diffRange == 0) {
	        lastRangeStart = dayFrom;
	    }
	    lastRangeEnd = dayTo;
	    
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
		lastRangeStart = 0;
		if (diffRange == 0) {
	        lastRangeStart = monthFrom;
	    }
	    lastRangeEnd = monthTo;
	    
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
		lastRangeStart = 0;		
	    lastRangeEnd = 1;
	}
	lastRangeSize = lastRangeEnd - lastRangeStart + 1;
	int totalNumCell = firstRangeSize + middleRangeSize + lastRangeSize;
	
	// la larghezza delle celle (subrange) dipende dalla quantita' di range e subrange che si vogliono visualizzare
	// e cosi' anche la descrizione del subrange
	boolean shortSubRange = false;
	int cellWidth = 0;
	if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
		cellWidth = 22;
		if (totalNumCell > 27) {
			cellWidth = 18;
			shortSubRange = true;
		}
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
		cellWidth = 30;
		if (totalNumCell > 24) {
			cellWidth = 20;
			shortSubRange = true;
		}
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
		cellWidth = 30;		
	}
	
	// pixel occupati dalle immagini quali le barre separatrici e la barra del today, di cui si deve tener conto quando si 
	// calcola la posizione degli oggetti
	int pixelToSubtract = 0;
	if (firstRangeSize > 0) {
		pixelToSubtract = middleRanges + 1;
	}
	
	// posizione della barra separatrice nel firstRange
	int firstRangeSeparatorPosition = firstRangeSize * cellWidth;
	
	// Calcolo la posizione della barra today (e se deve essere visualizzata)
	int todayPosition = -1;	
	Date firstDayFrom = from;
	Date lastDayTo = to;
	if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
		firstDayFrom = from;
		lastDayTo = to;
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
		Calendar calendar = DateLib.dateToCalendar(from);
		calendar.set(Calendar.DAY_OF_MONTH, 1); 
		firstDayFrom = calendar.getTime(); // primo giorno del primo mese visualizzato
		calendar = DateLib.dateToCalendar(to);
		calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); 
		lastDayTo = calendar.getTime(); // ultimo giorno dell'ultimo mese visualizzato
	} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
	    firstDayFrom = from;
		lastDayTo = to;
	}
	boolean showToday = !today.before(firstDayFrom) && !today.after(lastDayTo);
	if (showToday) {
		todayPosition = getPosition(firstDayFrom, today, cellWidth, pixelToSubtract, scale);
		pixelToSubtract += 2;
	}
	
%>


<!-- Scelta del periodo di elaborazione --> 
<table border="0" cellpadding="0" cellspacing="0" >
	<tr>
		<td class="form-label">
			<span>${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi')}</span>
		</td>
		<td class="form-input">
			<select type="text" name="comboAnni" id="numeroAnni">
				<option value="1" >${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi1')}</option>
				<option value="2" >${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi2')}</option>
				<option value="3" >${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi3')}</option>
				<option value="4" >${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi4')}</option>
				<option value="5" >${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi5')}</option>
				<option value="" >${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisiT')}</option>
			</select>
		</td>
		<td>
			&nbsp;&nbsp;
		</td>
		<td>
			<input class="generic-button ui-state-default ui-corner-all" type="button" id="btnGo" value="${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_perAnalisi_BUTTON')}" onclick="refreshQuadro()"/>
		</td>
	</tr>
</table>
 
<script type="text/javascript">
$(document).ready(
	function(){
		$("#numeroAnni").val(<%=request.getAttribute("quadriRiassuntiviNumeroAnni")%>);
	}
);

function refreshQuadro() {  		
	var numeroAnni = $("#numeroAnni").val();
	var params = 'numeroAnni=' + numeroAnni;
	
	juiceSetHref(document.location, addParamsToUrl(juiceGetEvent('quadririassuntivi.reloadQuadroRiassuntivo'), params));
}
</script>

<!-- Tabella principale del gantt -->

<%@page import="java.util.Iterator"%><table cellspacing="0" cellpadding="0">
<%	
	int cnt = 0;
	QuadroRiassuntivoDto[] quadriRiassuntiviDto = (QuadroRiassuntivoDto[])request.getAttribute("quadri_riassuntivi_dto");
	for (int index=0; index < quadriRiassuntiviDto.length; index++) {
		String nominativo = quadriRiassuntiviDto[index].getNominativo();
		List items = quadriRiassuntiviDto[index].getItems();
		String ganttCellRightClass = "gantt-cell-right";
		if (items.size() > 0) {
		    
%>		
	<tr>
		<td colspan="<%=totalNumCell + 3%>">
			&nbsp;
		</td>
	</tr>
	<!-- Prima riga di intestazione -->
	<tr>
		<td colspan="3" class="generic-nominativo">&nbsp;<%=nominativo%></td><%			
			String rangeName;
			int numRange = 0;
			int numSubRange = 0;
			// FIRST RANGE
			if (firstRangeSize > 0) {
				if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
					numRange = monthFrom;
				} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
					numRange = yearFrom;
				} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
				    numRange= yearFrom;
				}
				numSubRange = firstRangeSize;
				rangeName = getRangeName(numRange, numSubRange, shortSubRange, scale);
				%><td colspan="<%=numSubRange%>" class="gantt-time"><%=rangeName%></td><%
			}
			// MIDDLE RANGES
			calendarFrom = DateLib.dateToCalendar(from);
			for (int i=0; i<middleRanges; i++) {
				if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
					calendarFrom.add(Calendar.MONTH, 1);
					numRange = calendarFrom.get(Calendar.MONTH);
					numSubRange = calendarFrom.getActualMaximum(Calendar.DAY_OF_MONTH);
				} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
					numRange = numRange + 1;
					numSubRange = 12;
				} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
					numRange = numRange + 1;
					numSubRange = 2;
				}
				rangeName = getRangeName(numRange, numSubRange, shortSubRange, scale);
				%><td colspan="<%=numSubRange%>" class="gantt-time gantt-leftborder1"><%=rangeName%></td><%
			}
			// LAST RANGE
			if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
				numRange = monthTo;
			} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
				numRange = (numRange == 0) ? yearFrom : numRange + 1;
			} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
				numRange = numRange + 1;
			}
			numSubRange = lastRangeSize;	
			rangeName = getRangeName(numRange, numSubRange, shortSubRange, scale);
			if (firstRangeSize == 0) {
				%><td colspan="<%=numSubRange%>" class="gantt-time"><%=rangeName%></td><%
			} else {
				%><td colspan="<%=numSubRange%>" class="gantt-time gantt-leftborder1"><%=rangeName%></td><%
			}
	%></tr>
	<tr>
		<td class="gantt-title">${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_ganttDesc')}</td>
		<td class="gantt-title gantt-leftborder1">${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_ganttIniz')}</td>
		<td class="gantt-title gantt-leftborder1">${j:bundle('LBL_quadririassuntivi_quadroRiassuntivo_ganttFine')}</td><%
			String subRangeName;
			// FIRST RANGE
			numSubRange = firstRangeStart;
			for (int i=0; i<firstRangeSize; i++) {
				subRangeName= getSubRangeName(numSubRange, shortSubRange, scale);
				%><td class="gantt-subtime" width="<%=cellWidth - 1%>"><%=subRangeName%></td><%
				numSubRange++;
			}
			// MIDDLE RANGES
			calendarFrom = DateLib.dateToCalendar(from);
			for (int i=0; i<middleRanges; i++) {
				if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
					calendarFrom.add(Calendar.MONTH, 1);
					numSubRange = calendarFrom.getActualMaximum(Calendar.DAY_OF_MONTH);
				} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
					numSubRange = 12;
				} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
					numSubRange = 2;
				}
				int num = 0;
				for (int j=0; j<numSubRange; j++) {
					if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
						num = j+1;
					} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
						num = j;
					} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
						num = j;
					}
					subRangeName= getSubRangeName(num, shortSubRange, scale);
					%><td class="gantt-subtime" width="<%=cellWidth - 1%>"><%=subRangeName%></td><%
				}
			}
			// LAST RANGE
			numSubRange = lastRangeStart;
			for (int i=0; i<lastRangeSize; i++) {
				subRangeName= getSubRangeName(numSubRange, shortSubRange, scale);
				%><td class="gantt-subtime" width="<%=cellWidth - 1%>"><%=subRangeName%></td><%
				numSubRange++;
			}
	%></tr><%
	String currentCategory = null;
	for (int i=0; i<items.size(); i++) {
		Item item = (Item)items.get(i);
		String category = item.getCategory();
		String categoryDescription = item.getCategoryDescription();
		String itemDescription = item.getDescription();
		String itemShortDesc = item.getShortDescription();
		boolean erroreConnesione = (item instanceof ConnectionErrorItem);
		Date itemFrom = item.getFrom();
		Date itemTo = item.getTo();
		String itemFrom_str = DateLib.format(itemFrom);
		String itemTo_str = "&nbsp;";
		if (itemTo != null && item.getRange() && item.getCompleted()) {
			itemTo_str = DateLib.format(itemTo);
		}
		
		// ultimo item ==> devo visualizzare anche il bottom		
		if (i == items.size() - 1) {
			ganttCellRightClass += "-bottom";
		}		
		
		// SERVIZIO (CATEGORY)
		if (!category.equals(currentCategory)) {
			currentCategory = category;
			String classCategory = (erroreConnesione ? "gantt-category-error" : "gantt-category");
			%><tr>
				<td colspan="3" class="<%=classCategory%>"><%=categoryDescription%></td>
				<td colspan="<%=totalNumCell%>" class="gantt-cell-right"><%
					boolean needWhiteSpace = true;
					if (firstRangeSize > 0) {
						needWhiteSpace = false;
						%><img src="<%=img_spacer%>" class="gantt-separator" style="left:<%=firstRangeSeparatorPosition%>px;"><%
						int separatorPos = firstRangeSeparatorPosition;
						calendarFrom = DateLib.dateToCalendar(from);
						for (int j=0; j<middleRanges; j++) {
							if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
								calendarFrom.add(Calendar.MONTH, 1);
								int daysInMonth = calendarFrom.getActualMaximum(Calendar.DAY_OF_MONTH);
								separatorPos += (daysInMonth * cellWidth);
							} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
								separatorPos += (12 * cellWidth) - 1;
							} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
								separatorPos += (2 * cellWidth) - 1;
							}
							%><img src="<%=img_spacer%>" class="gantt-separator" style="left:<%=separatorPos%>px;"><%
						}
					}
					if (showToday) {
						needWhiteSpace = false;
						%><img src="<%=img_spacer%>" class="gantt-today" style="left:<%=todayPosition%>px;"><%	
					}
					if (needWhiteSpace) {
						%>&nbsp;<%
					}
				%></td>
			</tr><%
			} // Fine IF su cambio categoria
			if (erroreConnesione) { %>
			    <tr id="trgantt<%=cnt%>">
					<td colspan="<%=totalNumCell + 3%>" class="gantt-detail-error" style="font-weight: normal;">
						<img src="${j:getResourceUrlOfModule('shell','img/messages/error-small.gif')}" align="absmiddle"/>
						&nbsp;Attenzione: il servizio remoto non  raggiungibile
					</td>
				</tr>
			    <%
			} else {
			%><!-- ITEM -->
			<tr>
				<td id="trgantt<%=cnt%>-td0" class="gantt-description gantt-leftborder2" title="<%=itemDescription%>">
					<a href="javascript: show('trgantt<%=cnt%>');"><img id="trgantt<%=cnt%>-img" src="<%=img_plus%>" border="0"></a>
					&nbsp;<%=itemShortDesc%>
				</td>
				<td id="trgantt<%=cnt%>-td1" class="gantt-description"><%=itemFrom_str%></td>
				<td id="trgantt<%=cnt%>-td2" class="gantt-description"><%=itemTo_str%></td>
				<td id="trgantt<%=cnt%>-td3" colspan="<%=totalNumCell%>" class="<%=ganttCellRightClass%>"><%
					if (firstRangeSize > 0) {
						%><img src="<%=img_spacer%>" class="gantt-separator" style="left:<%=firstRangeSeparatorPosition%>px;"><%
						int separatorPos = firstRangeSeparatorPosition;
						calendarFrom = DateLib.dateToCalendar(from);
						for (int j=0; j<middleRanges; j++) {
							if (QuadroRiassuntivoJspSupport.SUB_RANGE_DAYS.equals(scale)) {
								calendarFrom.add(Calendar.MONTH, 1);
								int daysInMonth = calendarFrom.getActualMaximum(Calendar.DAY_OF_MONTH);
								separatorPos += (daysInMonth * cellWidth);
							} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_MONTHS.equals(scale)) {
								separatorPos += (12 * cellWidth) - 1;
							} else if (QuadroRiassuntivoJspSupport.SUB_RANGE_YEARS.equals(scale)) {
								separatorPos += (2 * cellWidth) - 1;
							}
							%><img src="<%=img_spacer%>" class="gantt-separator" style="left:<%=separatorPos%>px;"><%
						}
					}
					if (showToday) {
						%><img src="<%=img_spacer%>" class="gantt-today" style="left:<%=todayPosition%>px;"><%	
					}
					int startPos = 0;
					if (itemFrom.after(firstDayFrom)) {
						startPos = getPosition(firstDayFrom, itemFrom, cellWidth, pixelToSubtract, scale);
					}
					int barWidth = 0;
					if (item.getRange()) {
						if (itemTo != null) {
							if (itemTo.after(lastDayTo)) {
								itemTo = lastDayTo;
							}
							int endPos = getPosition(firstDayFrom, itemTo, cellWidth, pixelToSubtract, scale);
							barWidth = endPos - startPos;
						} else {
							barWidth = 10;
						}
						if (item.getCompleted()) {
							%><img src="<%=img_spacer%>" class='gantt-blue-bar' style='left:<%=startPos%>px;' width='<%=barWidth%>'><%
						} else {
							%><img src="<%=img_spacer%>" class='gantt-blue-bar-norightborder' style='left:<%=startPos%>px;' width='<%=barWidth%>'><img src="<%=img_spacer%>" class='gantt-blue-point' style='left:<%=startPos - 2%>px;'><%
						}
					} else {
						startPos -= 4;
						%><img src="<%=img_diamond%>" class='gantt-blue-diamond' style='left:<%=startPos%>px;'><%
					}
				%></td>
			</tr>
			<!-- DESCRIZIONI DEGLI ITEM (a scomparsa) -->
			<tr id="trgantt<%=cnt%>" style="display: none">			
				<td colspan="<%=totalNumCell + 3%>" class="gantt-detail-table">
					<table class="gantt-detail-subtable"><%
						request.setAttribute("currentItem", item);
						/** la renderizzazione della riga  demandata al tile di riferimento */
						%><tr>
							<j:tile name="<%=item.getTileIdentifier()%>" />
						</tr>
					</table>
				</td>
			</tr><%
			}
			cnt++;
		}
	}
}
%>
</table>