<div id="viewPortfolio">
<!-- 	<div id="bannerContentNI"> -->
<!-- 	    <div class="header"> -->
<!-- 	        <div class="headerLeft"></div> -->
<!-- 	    </div>   -->
<!-- 	</div> -->

	<div class="breadcrumbRight">&nbsp;</div>
	<div id="breadcrumb" msgid="titleCashMovement">Cash Movement</div>
	
	<div id="masterContent">
		<div id="pageTitle" class="content" msgid="titleCashMovement">Cash Movement</div>
		
		<div id="date" class="content">
			<table>
				<tr>
					<td class="setDateTd">
						<span class="asOfDate" msgid="publicDate">As of Date:</span> 
						<select
							id="cashMovementSelectId" 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>
				{{each(i,portfolioNum) getKeyArray(data.result.movements) }}
				<div class="content">
					<div class="pDetail">
						<span><b msgid="publicAccountNumber">Account Number:</b> <b>${app.selectBpKey}</b></span><span style="margin-left: 50px;"></span>
						<span><b msgid="publicPortfolioNumber">Portfolio Number:</b> <b>${portfolioNum}</b></span><span style="margin-left: 50px;"></span>
						<span><b msgid="publicNetAssetValues">Net Asset Value:</b> <b id="netAsset${i}"></b></span>
						<br/>
						<span><b msgid="publicPortfolioName">Portfolio Name:</b> <b>${formatMoney(data.result.portfolio[portfolioNum].portfolioName)}</b></span>
					</div>
					
					{{each(j,completeTran) getKeyArray(data.result.movements[portfolioNum]) }}					
					{{each(k,portfolioCurrency) getKeyArray(data.result.movements[portfolioNum][completeTran]) }}
					 <div class="otherDetail">
					 {{if j!=0 || k!=0}}
					 	<div class="spaceBetweenTxTable">&nbsp;</div>
					 {{/if}}
					 {{if completeTran =='Completed Transactions' }}
						<font style="font-weight:bold"><span msgid="pDetailPeriod">Period:</span> ${data.result.totalDto[portfolioCurrency + "_" + completeTran].period}</font>
					 {{else}}
					 	<font style="font-weight:bold"><span msgid="pFromValueDate">From value date:</span> ${data.result.totalDto[portfolioCurrency + "_" + completeTran].fromValueDate}</font>
					 {{/if}}
					 <br/>
					<font>${portfolioCurrency.substring(portfolioCurrency.length-3)} - ${portfolioCurrency} - ${completeTran}</font>
					</div>
					<table id="positionDTable" class="positionDT" style="background: #fff">
					    <thead>
			        		<tr >
			            		<th style="text-indent: 7px;">
			            			<span msgid="cashMovementSysDate">System Date</span>
			            		</th>
			                	<th>
			                		<span msgid="cashMovementValueDate">Value Date</span>
			                	</th>
			                	<th>
			                		<span msgid="cashMovementRef">Ref-No.</span>
			                	</th>
			                	<th style="width: 270px;text-align:left;">
			                		<span msgid="cashMovementDesc">Description</span>
			                	</th>
			                	<th>
			                		<span msgid="cashMovementDebit">Debit</span>
			                	</th>
			                	<th>
			                		<span msgid="cashMovementCredit">Credit</span>
			                	</th>
			                	<th>
			                		<span msgid="cashMovementBalance">Balance</span> ${portfolioCurrency.substring(portfolioCurrency.length-3)}
			                	</th>
			         		</tr>
			         	</thead>
			         	<tbody>
			         		<tr>
			         			<td></td>
			         			<td>${data.result.totalDto[portfolioCurrency + "_" + completeTran].openBalanceValueDate}</td>
			         			<td></td>
			         			<td style="text-align:left" msgid="pOpeningBalance">Opening Balance</td>
			         			<td></td>
			         			<td></td>
			         			<td>${formatMoney(data.result.totalDto[portfolioCurrency + "_" + completeTran].openBalance)}</td>
			         		</tr>
			         		{{each data.result.movements[portfolioNum][completeTran][portfolioCurrency]}}
			         		{{if $index%2==1 }}
			         			<tr class="even">
			         		{{else}}
			         			<tr class="odd">
			         		{{/if}}
			         			<td>${sysDate}</td>
			         			<td>${valueDate}</td>
			         			<td>${refNo}</td>
			         			<td><div style="word-wrap: break-word;width: 270px;overflow:hidden;"><p align="left">${transactionType}</p><p align="left">${desc}</p></div></td>
			         			<td nowrap>${formatMoney(debit)}</td>
			         			<td nowrap>${formatMoney(credit)}</td>
			         			<td nowrap>${formatMoney(balance)}</td>
			         		</tr>
			         		{{/each}}
			         		<!-- total -->
			         		<tr>
			         			<td colspan="3" style="border-top: 1px solid;"></td>
			         			<td style="border-top: 1px solid;">
			         				<span msgid="cashMovementTotalCredit">Total Credit</span>
			         			</td>
			         			<td style="border-top: 1px solid;"></td>
			         			<td style="border-top: 1px solid;" nowrap>${formatMoney(data.result.totalDto[portfolioCurrency + "_" + completeTran].totalCredit)}</td>
			         			<td style="border-top: 1px solid;"></td>
			         		</tr>
			         		<tr>
			         			<td colspan="3"></td>
			         			<td>
			         				<span msgid="cashMovementTotalDebit">Total Debit</span>
			         			</td>
			         			<td nowrap>${formatMoney(data.result.totalDto[portfolioCurrency + "_" + completeTran].totalDebit)}</td>
			         			<td></td>
			         			<td></td>
			         		</tr>
			         		{{if completeTran =='Completed Transactions' }}
			         		<tr>
			         			<td></td>
			         			<td nowrap>${data.result.totalDto[portfolioCurrency + "_" + completeTran].closingBalanceValueDate}</td>
			         			<td></td>
			         			<td msgid="pCloseBalance">Closing balance</td>
			         			<td></td>
			         			<td></td>
			         			<td nowrap>${formatMoney(data.result.totalDto[portfolioCurrency + "_" + completeTran].closingBalance)}</td>
			         		</tr>
			         		{{/if}}
			         	</tbody>
			         
			         </table> 
			         {{/each}}
			         {{/each}}
			         <p>&nbsp;</p>
				</div>
				
				{{/each}}
				{{if getKeyArray(data.result.movements).length == 0 }}
						<div class="content">
							<P msgid="publicNoSelectDate ">There is no record for the selected date</P>
						</div>
				{{/if}}
			</div>
		{{/if}}
	   <div class="footer">
				<img src="images/layout/bkg-content-base-right.gif?version=|||xxx|||">
		</div>	
   </div>
</div>