I have created a simple table of data in a VF page, which uses Apex:Repeat to list records.
There is a column that contains a cumulative amount, by way of apex:variable. The cumulative amount works fine and repeats, however i need to add a starting amount (currentRecord.Opening_Balance__c) at the top of the column, which the first record in the list uses as a opening amount.
The issue is, adding the variable to the first record amount, and not to every record amount thereafter.
The table on the left is what i am trying to achieve. The table on the right is what I have currently, without applying the "Opening Balance" variable.
I haven't seen this applied elsewhere, so any thoughts would be appreciated...
APEX:
<apex:outputPanel id="records" styleClass="panel">
<table style="width:100%;">
<thead>
<tr>
<th style="text-align:left">Date</th>
<th style="text-align:left">Transaction Details</th>
<th style="text-align:left">Withdrawals</th>
<th style="text-align:left">Deposits</th>
<th style="text-align:left">Balance</th>
</tr>
</thead>
<tbody>
<apex:variable value="{!0}" var="Total"/>
<apex:variable value="{!currentRecord.Opening_Balance__c}" var="open"/>
<tr>
<td colspan="4"><b>Opening Balance</b></td>
<td><b>{!currentRecord.Opening_Balance__c}</b></td>
</tr>
<apex:repeat value="{!remittanceAdvice}" var="re" >
<tr>
<td><apex:outputfield value="{!re.Date__c}"/></td>
<td>{!re.Account__r.name}</td>
<td>{!re.Remittance_Total_Debit__c}</td>
<td>{!re.Remittance_Total_Credit__c}</td>
<apex:variable var="Total" value="{!Total - re.Remittance_Total_Debit__c + re.Remittance_Total_Credit__c }"/>
<td>{!Total}</td>
</tr>
</apex:repeat>
<tr>
<td colspan="4"><b>Closing Balance</b></td>
<td><b>{!currentRecord.Closing_Balance__c}</b></td>
</tr>
</tbody>
</table>
</apex:outputPanel>
<apex:variable value="{!currentRecord.Opening_Balance__c}" var="open"/>
what else you want to add here?