Added first output tests

This commit is contained in:
Rick Falkvinge
2018-02-15 16:47:30 +01:00
parent 44374cdd1b
commit e3e53a4ec8
3 changed files with 106 additions and 3 deletions
+20 -2
View File
@@ -130,7 +130,8 @@
// Display processed data
$('#expensifyDataGrid').datagrid({});
$('#expensifyDataGrid').datagrid('loadData', result.Data);
} else {
@@ -217,7 +218,24 @@
<h2><asp:Label ID="LabelExpensifyProcessingComplete" runat="server" /></h2>
<div id="divExpensifyResultsGood" style="display:none">Good results go here<div id="DivUploadResultsGoodText"></div></div>
<div id="divExpensifyResultsGood" style="display:none">
<table id="expensifyDataGrid" class="easyui-datagrid" style="width:680px"
data-options="rownumbers:false,singleSelect:false,nowrap:false,fitColumns:true,fit:false,showFooter:true,loading:false,selectOnCheck:true,checkOnSelect:true"
idField="expenseId">
<thead>
<tr>
<th data-options="field:'CreatedDateTime',width:60"><asp:Label ID="LabelGridHeaderCreatedDate" runat="server" Text="XYZ Created" /></th>
<th data-options="field:'Budget',width:130"><asp:Label ID="LabelGridHeaderBudget" runat="server" Text="XYZ Due" /></th>
<th data-options="field:'Description',width:140"><asp:Label ID="LabelExpensifyHeaderDescription" runat="server" Text="XYZ Person / Organization" /></th>
<th data-options="field:'AmountVat',width:180,align:'right'"><asp:Label ID="LabelExpensifyHeaderVat" runat="server" Text="XYZ Description" /></th>
<th data-options="field:'Amount',width:90,align:'right'"><asp:Label ID="LabelExpensifyHeaderAmount" runat="server" Text="XYZ Amount" /></th>
<th data-options="field:'Docs',width:43,align:'center'"><asp:Label ID="LabelExpensifyHeaderDocs" runat="server" Text="XYZAct" /></th>
</tr>
</thead>
</table>
</div>
<div id="divExpensifyResultsBad" style="display:none">
<div style="float:left;margin-right:10px"><img src="/Images/Icons/iconshock-cross-96px.png" /></div><div id="divExpensifyResultsBadText"></div>
@@ -508,6 +508,25 @@ namespace Swarmops.Frontend.Pages.v5.Financial
// TODO: Once user has confirmed budgets, save expenses
List<ExpensifyOutputRecord> outputRecords = new List<ExpensifyOutputRecord>();
foreach (ExpensifyRecord record in recordList)
{
outputRecords.Add(new ExpensifyOutputRecord
{
Description = record.Description,
Amount = (record.AmountCents / 100.0).ToString("N2")
});
}
AjaxCallExpensifyUploadResult result = new AjaxCallExpensifyUploadResult
{
Success = true,
Data = outputRecords.ToArray()
};
GuidCache.Set("Results-" + guidFiles, result);
progress.Set(100);
}
@@ -524,6 +543,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
public class BarfException: Exception {}
private enum ExpensifyColumns
{
Unknown = 0,
@@ -693,10 +713,21 @@ namespace Swarmops.Frontend.Pages.v5.Financial
}
public class ExpensifyOutputRecord
{
public string Description { get; set; }
public string Budget { get; set; }
public string Amount { get; set; }
public string AmountVat { get; set; }
}
public class AjaxCallExpensifyUploadResult: AjaxCallResult
{
public string ErrorType { get; set; }
// Todo: the whole damn data structure
public ExpensifyOutputRecord[] Data;
}
@@ -237,6 +237,60 @@ namespace Swarmops.Frontend.Pages.v5.Financial {
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelExpensifyProcessingComplete;
/// <summary>
/// LabelGridHeaderCreatedDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelGridHeaderCreatedDate;
/// <summary>
/// LabelGridHeaderBudget control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelGridHeaderBudget;
/// <summary>
/// LabelExpensifyHeaderDescription control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelExpensifyHeaderDescription;
/// <summary>
/// LabelExpensifyHeaderVat control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelExpensifyHeaderVat;
/// <summary>
/// LabelExpensifyHeaderAmount control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelExpensifyHeaderAmount;
/// <summary>
/// LabelExpensifyHeaderDocs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelExpensifyHeaderDocs;
/// <summary>
/// LabelExpensifyUploadHeader control.
/// </summary>