<!DOCTYPE html>
<html lang="en">
{{fscript
	globals setProjectsForDisplay:selectedObjects.	
}}
<head>
	<meta charset="utf-8">
	<link rel="stylesheet" href="{{framework}}/default.css" type="text/css" charset="utf-8">
	<link rel="stylesheet" href="{{framework}}/screen.css" type="text/css" charset="utf-8" media="screen">
	<link rel="stylesheet" href="{{framework}}/print.css" type="text/css" charset="utf-8" media="print">
	<link rel="stylesheet" href="{{resources}}/custom.css" type="text/css" charset="utf-8">
	
</head>
<body>
	<h2>{{localize 'Projects'}}</h2>
	{{foreach project projectsForDisplay do}}
	<table>
	<tr>
	<td>
		{{fscript
						
			((project extra1 == nil) & (project extra2 == nil) & (project extra3 == nil) & (project extra4 == nil) & (project extra5 == nil)
			 & (project extra6 == nil) & (project extra7 == nil) & (project extra8 == nil) & (project extra9 == nil) & (project extra10 == nil)
			 & (project extra11 == nil) & (project extra12 == nil) & (project extraDate1 == nil) & (project extraDate2 == nil)
			 & (project extraDate3 == nil) & (project extraDate4 == nil))ifTrue:
			[globals setShowExtraFields:''.].

		}}
		<h3>{{project.name}}</h3>
		
		<span id="labelHeader">{{localize 'Status'}}:</span> {{project.statusString}}<br>
		{{if project.dueDate}}<span id="labelHeader">{{localize 'Due Date'}}:</span> {{project.dueDate.mcLongDateTime}}<br>{{endif}}
		{{if project.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{project.startDate.mcLongDateTime}}<br>{{endif}}
		{{if project.completeDate}}<span id="labelHeader">{{localize 'Complete Date'}}:</span> {{project.completeDate.mcLongDateTime}}<br>{{endif}}
		{{if project.fullEstimatedTimeString}}<span id="labelHeader">{{localize 'Estimated Time'}}:</span> {{project.fullEstimatedTimeString}}<br>{{endif}}
		
		{{if project.category}}<span id="labelHeader">{{localize 'Category'}}:</span> {{project.category.name}}<br>{{endif}}
		{{if project.keywordsString}}<span id="labelHeader">{{localize 'Keywords'}}:</span> {{project.keywordsString}}<br>{{endif}}
		<br>
		{{if project.currentPipeline}}<span id="labelHeader">{{localize 'Current Pipeline'}}:</span> {{project.currentPipeline.name}}<br>{{endif}}
		{{if project.currentPipelineStage}}<span id="labelHeader">{{localize 'Current Pipeline Stage'}}:</span> {{project.currentPipelineStage.name}}<br><br>{{endif}}
		
		{{if project.dueDate}}<span id="labelHeader">{{localize 'Details'}}:</span><br>
		{{project.details}}<br><br>{{endif}}
		
		{{if project.opportunity}}<div id="groupHeader">{{localize 'OPPORTUNITY'}}</div><br>{{endif}}
		{{if project.opportunity}}<span id="labelHeader">{{localize 'Opportunity'}}:</span> {{project.opportunity.name}}<br>{{endif}}
		{{if project.opportunity.completeDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{project.opportunity.completeDate.mcLongDateTime}}<br>{{endif}}

		{{if project.contactRoles.@count}}
		<div id="groupHeader">{{localize 'CONTACTS'}}</div><br>
			{{foreach role project.contactRoles do}} 
			<b>{{role.contact.firstname}} {{role.contact.lastname}}</b><br>
			<span id="labelHeader">{{localize 'Role Type'}}:</span> {{role.roleType.name}}<br>
			<span id="labelHeader">{{localize 'Title'}}:</span> {{role.name}}<br>
			<span id="labelHeader">{{localize 'Default Phone'}}:</span> {{role.contact.defaultPhone.phoneNumber}}<br><br>
			{{endforeach do}}
		{{endif}}
		
		{{if project.organizationRoles.@count}}
		<div id="groupHeader">{{localize 'COMPANIES'}}</div><br>
			{{foreach role project.organizationRoles do}} 
			<b>{{role.organization.name}}</b><br>
			<span id="labelHeader">{{localize 'Role Type'}}:</span> {{role.roleType.name}}<br>
			<span id="labelHeader">{{localize 'Title'}}:</span> {{role.name}}<br>
			<span id="labelHeader">{{localize 'Default Phone'}}:</span> {{role.organization.defaultPhone.phoneNumber}}<br><br>
			{{endforeach do}}
		{{endif}}

		{{if project.nextPendingTask}}
		<div id="groupHeader">{{localize 'NEXT TASK'}}</div>
		<br>
		<b>{{project.nextPendingTask.title}}</b><br>
		{{if project.nextPendingTask.dueDate}}<span id="labelHeader">{{localize 'Due'}}:</span> {{project.nextPendingTask.dueDate.mcShortDate}}<br>{{endif}}
		{{if project.nextPendingTask.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{project.nextPendingTask.startDate.mcLongDate}}<br>{{endif}}
		{{if project.nextPendingTask.completeDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{project.nextPendingTask.completeDate.mcLongDate}}<br>{{endif}}
		{{if project.nextPendingTask.priorityString}}<span id="labelHeader">{{localize 'Priority'}}:</span> {{project.nextPendingTask.priorityString}}<br>{{endif}}
		{{endif}}
		<br>
		
		{{if project.timeblocks.@count}}
		<div id="groupHeader">{{localize 'APPOINTMENTS'}}</div><br>
			{{foreach appointment project.timeblocks do}} 
			<b>{{appointment.subject}}</b><br>
			<span id="labelHeader">{{localize 'Status'}}:</span> {{appointment.statusString}}<br>
			<span id="labelHeader">{{localize 'Time'}}:</span> {{appointment.startDate.mcLongDate}} at {{appointment.startDate.mcShortTime}} - {{appointment.endDate.mcShortTime}}<br>
			<span id="labelHeader">{{localize 'Details'}}:</span> {{appointment.details}}<br><br>
			{{endforeach do}}
			<br><br>
		{{endif}}
		
		{{if project.tasks.@count}}
		<div id="groupHeader">{{localize 'TASKS'}}</div><br>
			{{foreach task project.tasks do}} 
			<b>{{task.title}}</b><br>
			{{if task.dueDate}}<span id="labelHeader">{{localize 'Due'}}:</span> {{task.dueDate.mcLongDate}}<br>{{endif}}
			{{if task.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{task.startDate.mcLongDate}}<br>{{endif}}
			{{if task.completeDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{task.completeDate.mcLongDate}}<br>{{endif}}
			{{if task.priorityString}}<span id="labelHeader">{{localize 'Priority'}}:</span> {{task.priorityString}}<br>{{endif}}
			<br>
			{{endforeach do}}
		{{endif}}
		
		{{if project.groups.@count}}
		<div id="groupHeader">{{localize 'GROUPS'}}</div><br>
			{{foreach group project.groups do}} 
			<b>{{group.name}}</b><br>
			{{if group.startDate}}<span id="labelHeader">{{localize 'Start Date'}}:</span> {{group.startDate.mcLongDate}}<br>{{endif}}
			{{if group.endDate}}<span id="labelHeader">{{localize 'End Date'}}:</span> {{group.endDate.mcLongDate}}<br>{{endif}}
			<br>
			{{endforeach do}}
		{{endif}}

		{{if project.customRecordSets.@count}}
			<div id="groupHeader">{{localize 'FORMS'}}</div><br>
			{{foreach recordSet project.customRecordSets do}}
			{{recordSet.customRecordSetDefinition.name}}<br>
				{{foreach record recordSet.customRecords do}}
	 			<span id="labelHeader">{{record.customRecordDefinition.name}}</span></br>
				{{record.displayString}}<br>
				{{endforeach do}}<br>
 			{{endforeach do}}
			<br>
		{{endif}}
		
		{{if showExtraFields}}
		<div id="groupHeader">{{localize 'EXTRA FIELDS'}}</div><br>
			{{if project.extra1}}<span id="labelHeader">{{project.extraFieldsNames.extra1}}:</span> {{project.extra1}}<br>{{endif}}
			{{if project.extra2}}<span id="labelHeader">{{project.extraFieldsNames.extra2}}:</span> {{project.extra2}}<br>{{endif}}
			{{if project.extra3}}<span id="labelHeader">{{project.extraFieldsNames.extra3}}:</span> {{project.extra3}}<br>{{endif}}
			{{if project.extra4}}<span id="labelHeader">{{project.extraFieldsNames.extra4}}:</span> {{project.extra4}}<br>{{endif}}
			{{if project.extra5}}<span id="labelHeader">{{project.extraFieldsNames.extra5}}:</span> {{project.extra5}}<br>{{endif}}
			{{if project.extra6}}<span id="labelHeader">{{project.extraFieldsNames.extra6}}:</span> {{project.extra6}}<br>{{endif}}
			{{if project.extra7}}<span id="labelHeader">{{project.extraFieldsNames.extra7}}:</span> {{project.extra7}}<br>{{endif}}
			{{if project.extra8}}<span id="labelHeader">{{project.extraFieldsNames.extra8}}:</span> {{project.extra8}}<br>{{endif}}
			{{if project.extra9}}<span id="labelHeader">{{project.extraFieldsNames.extra9}}:</span> {{project.extra9}}<br>{{endif}}
			{{if project.extra10}}<span id="labelHeader">{{project.extraFieldsNames.extra10}}:</span> {{project.extra10}}<br>{{endif}}
			{{if project.extra11}}<span id="labelHeader">{{project.extraFieldsNames.extra11}}:</span> {{project.extra11}}<br>{{endif}}
			{{if project.extra12}}<span id="labelHeader">{{project.extraFieldsNames.extra12}}:</span> {{project.extra12}}<br>{{endif}}
		
			{{if project.extraDate1}}<span id="labelHeader">{{project.extraFieldsNames.extraDate1}}:</span> {{project.extraDate1.mcLongDateTime}}<br>{{endif}}
			{{if project.extraDate2}}<span id="labelHeader">{{project.extraFieldsNames.extraDate1}}:</span> {{project.extraDate1.mcLongDateTime}}<br>{{endif}}
			{{if project.extraDate3}}<span id="labelHeader">{{project.extraFieldsNames.extraDate3}}:</span> {{project.extraDate3.mcLongDateTime}}<br>{{endif}}
			{{if project.extraDate4}}<span id="labelHeader">{{project.extraFieldsNames.extraDate4}}:</span> {{project.extraDate4.mcLongDateTime}}<br>{{endif}}
		<br>
		{{endif}}

		
		{{if project.notes.@count}}
		<div id="groupHeader">{{localize 'NOTES'}}</div><br>
			{{foreach note project.notesSortedByCreateDateDescending do}}
			<span id="labelHeader">{{localize 'Title'}}:</span> {{note.title}}<br>
			<span id="labelHeader">{{localize 'Create Date'}}:</span> {{note.createDate.mcLongDateTime}}<br>
			<span id="labelHeader">{{localize 'Content'}}:</span> {{note.attachmentFreeTextRepresentation}}<br>
			<br><br>
			{{endforeach do}}
		{{endif}}
		
		{{if project.emails.@count}}
		<div id="groupHeader">{{localize 'EMAILS'}}</div><br>
			{{foreach email project.emails do}}
			<span id="labelHeader">{{localize 'Subject'}}:</span> {{email.subject}}<br>
			<span id="labelHeader">{{localize 'Sender'}}:</span> {{email.fromString}}<br>
			<span id="labelHeader">{{localize 'Create Date'}}:</span> {{email.createDate.mcLongDateTime}}<br>
			<span id="labelHeader">{{localize 'Content'}}:</span> {{email.largeData.plainTextRepresentation}}<br>
			<br><br>
			{{endforeach do}}
		{{endif}}
		<br>
	<td>
	<tr>
	</table>
	<br><br><br>
	{{endforeach do}}
	<br>
	<div id="reportfooter">
	{{localize 'Generated by %@ on %@', objectContext.user.contact.cachedName, date}}.		
	</div>

</body>
</html>