Skip to content

Commit

Permalink
improve portfolio table - account + account type columns
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelyea committed Jun 19, 2023
1 parent 60dfb35 commit 843c1a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
1 change: 0 additions & 1 deletion Pages/Portfolio-Review.razor
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ Portfolio Review@(stepPath==null?"":": "+stepPath.Replace('-',' ')) - bogle.tool
<option>Solo 401k</option>
<option>Taxable</option>
<option>Traditional IRA</option>
<option>Treasury Direct</option>
</select>
<span> at <input style="width:140px" type=text @bind-Value=account.Custodian @bind-Value:event=oninput placeholder='custodian' /></span><br/>
<span><label for=@accountId>Note: </label><input id=@accountId type=text @bind-value=account.Note @bind-value:event=oninput placeholder='account note'/></span>
Expand Down
29 changes: 19 additions & 10 deletions Pages/Portfolio.razor
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,21 @@ Portfolio@(stepPath==null?": review":": "+stepPath.Replace('-',' ')) - bogle.too
<table>
<tr>
<th>Account</th>
<th>Ticker</th>
<th>$ / share</th>
<th>Shares</th>
<th>Value</th>
<th style=padding-left:8px>Type</th>
<th style=padding-left:8px>Ticker</th>
<th style=padding-left:8px>$ / share</th>
<th style=padding-left:8px>Shares</th>
<th style=padding-left:8px>$ Value</th>
</tr>
@foreach (var account in familyData.Accounts) {
@foreach (var investment in account.Investments) {
<tr>
<td>@((MarkupString)((account.Identifier != null ? "<span>"+account.Identifier+"&nbsp;</span>" : "") + account.AccountType + (account.Custodian != null ? " at " + account.Custodian : "")))</td>
<td title=@investment.Name>@investment.Ticker</td>
<td style=text-align:right;padding-left:5px>@investment.Price</td>
<td style=text-align:right;padding-left:5px>@investment.Shares</td>
<td style=text-align:right;padding-left:5px>@investment.Value</td>
<td>@((account.Custodian != null ? account.Custodian + " ": "")+ account.Note)</td>
<td style=padding-left:8px>@((MarkupString)((account.Identifier != null ? "<span>"+account.Identifier+"&nbsp;</span>" : "") + account.AccountType))</td>
<td style=padding-left:8px title=@investment.Name>@investment.Ticker</td>
<td style=text-align:right;padding-left:8px>@formatDoubleTwoDecimal(investment.Price)</td>
<td style=text-align:right;padding-left:8px>@formatDoubleFourDecimal(investment.Shares)</td>
<td style=text-align:right;padding-left:8px>@formatDoubleTwoDecimal(investment.Value)</td>
</tr>
}
}
Expand Down Expand Up @@ -500,7 +502,6 @@ Portfolio@(stepPath==null?": review":": "+stepPath.Replace('-',' ')) - bogle.too
<option>Solo 401k</option>
<option>Taxable</option>
<option>Traditional IRA</option>
<option>Treasury Direct</option>
</select>
<span> at <input style="width:140px" type=text @bind-Value=account.Custodian @bind-Value:event=oninput placeholder='custodian' /></span><br/>
<span><label for=@accountId>Note: </label><input id=@accountId type=text @bind-value=account.Note @bind-value:event=oninput placeholder='account note'/></span>
Expand Down Expand Up @@ -765,6 +766,14 @@ Portfolio@(stepPath==null?": review":": "+stepPath.Replace('-',' ')) - bogle.too
{
return String.Format("${0:#,0.##}", amount);
}
public string formatDoubleTwoDecimal(double? amount)
{
return String.Format("{0:#,0.00}", amount);
}
public string formatDoubleFourDecimal(double? amount)
{
return String.Format("{0:#,0.0000}", amount);
}
public string formatMoneyThousands(double? amount)
{
if (amount == null) return "";
Expand Down
2 changes: 1 addition & 1 deletion Shared/Models/FamilyData/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static async Task<List<Account>> ImportCSV(string[] lines, IList<Fund> fu
{
newAccount = new() {
Custodian = "Fidelity",
Note = "*"+ accountNumber.Substring(accountNumber.Length-4,4) + " " + accountName
Note = "*"+ accountNumber.Substring(accountNumber.Length-4,4)
};
newAccount.GuessAccountType();
importedAccounts.Add(newAccount);
Expand Down

0 comments on commit 843c1a1

Please sign in to comment.