<div id="viewPortfolio">

	<div class="breadcrumbRight">&nbsp;</div>
	<div id="breadcrumb" msgid="titleFunds">Funds</div>
	
	<div id="masterContent">
		<div id="pageTitle" class="content" msgid="titleFunds">Funds</div>
		<div id="date" class="content">
			<table>
				<tr>
					<td class="setDateTd">
						<span class="asOfDate" msgid="publicDate">As of Date</span> 
						<select
							id="fundsSelectId" class="AsOfDate dropDownStyle">
							{{each(i,selectDate) app.user.asOfDate}}
						  		<option>${selectDate}</option>
							{{/each}}
						</select>
					</td>
					<td class="tdDateLine">
						<div class="dateLine"></div>
					</td>
				</tr>
			</table>
		</div>
	
	{{if (meta.errorType) != null}}
		<div class="content">The request fail, ErrorMessage:${meta.errorMessage}</div>
	{{else}}
		<div>
			<div id="fundSelectId" class="content">
			{{each(i, portfolioNumber) getKeyArray(data.result.assetPosition)}}
<!-- 			<div class="pDetail"> -->
<!-- 				<span><b>Account Number:</b>${app.selectBpKey}</span><span style="margin-left: 20px;"></span> -->
<!-- 				<span><b>Portfolio Number:</b> ${portfolioNumber}</span><span style="margin-left: 20px;"></span> -->
<!-- 				<span><b>Net Asset Value:</b></span><span id="netAsset${i}"></span> -->
<!-- 			</div> -->
			<table id="positionDTable" class="positionDT">
				<tr>
					<td colspan="9" class="netAssetValueTd">
						<span msgid="publicAccountNumber">Account Number:</span> ${app.selectBpKey}<span style="margin-left: 50px;"></span>
						<span msgid="publicPortfolioNumber">Portfolio Number:</span> ${portfolioNumber}<span style="margin-left: 50px;"></span>
						<span msgid="publicNetAssetValues">Net Asset Value:</span> <span id="netAsset${i}"></span>
						<br/>
						<span msgid="publicPortfolioName">Portfolio Name:</span> ${data.result.portfolio[portfolioNumber].portfolioName}
					</td>
				<tr>
				<tr>
	           		<th colspan="2" style="text-align:left;" class="indent6">
	           			<span msgid="pDetailDescription">Description</span>
	           		</th>
	               	<th>
	               		<span msgid="pDetailQuantity">Quantity</span>
	               	</th>
	               	<th>
	               		<span msgid="pDetailAvgPrice">Avg. Cost Price</span>
	               	</th>
	               	<th>
	               		<span msgid="pDetailMarketPrice">Market Price</span>
	               		<p msgid="pDetailDDMMYYYY" class="smallWord">DD.MM.YYYY</p>
	               	</th>
	               	<th>
	               		<span msgid="pDetailValue">Value</span>
	               	</th>
	               	<th>
	               		<span msgid="pDetailValue">Value</span> (${data.result.portfolio[portfolioNumber].refCcy})
	               	</th>
	               	<th>
	               		<span msgid="pDetailAlloc">Alloc. %</span>
	               	</th>
	               	<th>
	               		<span msgid="pDetailUnrealPL">Unreal. P/L</span>
	               		<p msgid="pDetailOrginalCurrency" class="smallWord">(Original Currency)</p>
	               	</th>
	        	</tr>
	        	{{each(x, class1Types) getKeyArray(data.result.assetPosition[portfolioNumber])}}
	         		<tr class="category_t1_l1"><td colspan="10" class="class1Category">${class1Types}</td></tr>
		         	{{each(j, types) getKeyArray(data.result.assetPosition[portfolioNumber][class1Types])}}
		         		<tr class="category_t1_l2"><td colspan="10" style="text-align:left;">&nbsp;</td></tr>
		         		{{each(k, typesData) getKeyArray(data.result.assetPosition[portfolioNumber][class1Types][types])}}
		         			{{if k%2==1 }}
			         			<tr class="even">
			         		{{else}}
			         			<tr class="odd">
			         		{{/if}}
		         			<td><div style="width:34px;word-wrap: break-word;overflow:hidden;">${data.result.assetPosition[portfolioNumber][class1Types][types][typesData].ccy}</div></td>
		         			<td>
			         			<div style="width:214px;word-wrap: break-word;overflow:hidden;">
			         				<p align="left">${data.result.assetPosition[portfolioNumber][class1Types][types][typesData].description1}</p>
			         				<p align="left" class="smallWord">${data.result.assetPosition[portfolioNumber][class1Types][types][typesData].description2}</p>
			         			</div>
		         			</td>		
		         			<td nowrap>
		         				${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].qty, true)}
		         			</td>
		         			<td>
		         				${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].avgCostPrice)}
		         			</td>
		         			<td>
		         				<p align="right">${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].marketPrice)}</p>
		         				<p align="right" class="smallWord">${data.result.assetPosition[portfolioNumber][class1Types][types][typesData].marketPriceDate}</p>
		         			</td>
		         			<td>
		         				${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].value)}
		         			</td>
		         			<td>
		         				${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].refValue)}
		         			</td>
		         			<td>
		         				${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].allocation)}
		         			</td>
		         			<td nowrap>
		         				${formatMoney(data.result.assetPosition[portfolioNumber][class1Types][types][typesData].unrealPL)}
		         			</td>
		         		</tr>
		         		{{/each}}
		         	{{/each}}
		         {{/each}}
	         		<tr class="total">
	         			<td msgid="pDetailTotal" style="font-weight:bold">Total</td>
	         			<td colspan="5"></td>
	         			<td>
	         				<p align="left"><b>${formatMoney(data.result.portfolio[portfolioNumber].refValueTotal)}</b></p>
	         			</td>
	         			<td><b>${formatMoney(data.result.portfolio[portfolioNumber].totalPercentage)}</b></td>
	         			<td colspan="2"></td>
	         		</tr>
	         </table> 
	         {{/each}}
	         
	         {{if getKeyArray(data.result.assetPosition).length == 0}}
	         	<div>There is no record for the selected date</div>
	         {{else}}
	         	<p>&nbsp;</p>
	         	<!-- Notes -->
			 	<div id="notes"></div>
	         {{/if}}
	         
			
			</div>
		</div>
	 {{/if}}
		
		<div class="footer">
			<img src="images/layout/bkg-content-base-right.gif?version=|||xxx|||">
		</div>
	</div>
</div>