Fixed invoiceable-outbound list (and spelling)

This commit is contained in:
Rick Falkvinge
2017-09-26 13:58:10 +02:00
parent 1f8a4703d2
commit b0f0c58d2f
4 changed files with 46 additions and 21 deletions
@@ -269,15 +269,41 @@ namespace Swarmops.Logic.Financial
int yearlyResultId = CostsYearlyResult.Identity;
FinancialAccounts costAccounts =
FinancialAccounts.ForOrganization (Organization.FromIdentity (this._organizationId),
FinancialAccounts.ForOrganization(Organization.FromIdentity(this._organizationId),
FinancialAccountType.Cost);
foreach (FinancialAccount account in costAccounts)
{
if (account.Identity != yearlyResultId && account.Expensable)
// really should be redundant, but still...
// really should be redundant, but still...
{
result.Add (account);
result.Add(account);
}
}
return result;
}
}
public FinancialAccounts InvoiceableBudgetsInbound
{
// TODO: This needs to return a tree, not a flat list.
get
{
FinancialAccounts result = new FinancialAccounts();
int yearlyResultId = CostsYearlyResult.Identity;
FinancialAccounts costAccounts =
FinancialAccounts.ForOrganization(Organization.FromIdentity(this._organizationId),
FinancialAccountType.Cost);
foreach (FinancialAccount account in costAccounts)
{
if (account.Identity != yearlyResultId)
// really should be redundant, but still...
{
result.Add(account);
}
}
@@ -294,17 +320,13 @@ namespace Swarmops.Logic.Financial
int yearlyResultId = CostsYearlyResult.Identity;
FinancialAccounts costAccounts =
FinancialAccounts revenueAccounts =
FinancialAccounts.ForOrganization (Organization.FromIdentity (this._organizationId),
FinancialAccountType.Income);
foreach (FinancialAccount account in costAccounts)
foreach (FinancialAccount account in revenueAccounts)
{
if (account.Identity != yearlyResultId && account.Expensable)
// really should be redundant, but still...
{
result.Add (account);
}
result.Add (account);
}
return result;
+11 -10
View File
@@ -13,23 +13,24 @@ namespace Swarmops.Frontend.Automation
Response.ContentType = "application/json";
// What type of budgets do we want?
// Allowed values are "Expensable", "InvoicableOut", or "InvoiceableIn". Default is "Expensable".
// Allowed values are "Expensable", "InvoiceableOut", or "InvoiceableIn". Default is "Expensable".
string accountTypeString = Request.QueryString["AccountType"];
AccountTypes accountType = AccountTypes.Unknown;
switch (accountTypeString.ToLowerInvariant())
{
case "invoicableout":
accountType = AccountTypes.InvoicablesOut;
case "invoiceableout":
accountType = AccountTypes.InvoiceablesOut;
break;
case "invoicablein":
accountType = AccountTypes.InvoicablesIn;
case "invoiceablein":
accountType = AccountTypes.InvoiceablesIn;
break;
case "expensable":
default:
accountType = AccountTypes.Expensables;
break;
default:
throw new ArgumentException("Unrecognized account category");
}
// Is this stuff in cache already?
@@ -56,11 +57,11 @@ namespace Swarmops.Frontend.Automation
switch (accountType)
{
case AccountTypes.InvoicablesOut:
case AccountTypes.InvoiceablesOut:
accounts = CurrentOrganization.FinancialAccounts.InvoiceableBudgetsOutbound;
break;
case AccountTypes.Expensables:
case AccountTypes.InvoicablesIn:
case AccountTypes.InvoiceablesIn:
accounts = CurrentOrganization.FinancialAccounts.ExpensableBudgets;
break;
default:
@@ -122,8 +123,8 @@ namespace Swarmops.Frontend.Automation
private enum AccountTypes
{
Unknown = 0,
InvoicablesOut,
InvoicablesIn,
InvoiceablesOut,
InvoiceablesIn,
Expensables
}
}
@@ -34,6 +34,8 @@ namespace Swarmops.Controls.Financial
return "/Automation/Json-BudgetsTree.aspx?AccountType=Expensable";
case AccountListType.InvoiceableOut:
return "/Automation/Json-BudgetsTree.aspx?AccountType=InvoiceableOut";
case AccountListType.InvoiceableIn:
return "/Automation/Json-BudgetsTree.aspx?AccountType=InvoiceableIn";
case AccountListType.All:
return "/Automation/Json-FinancialAccountsTree.aspx?AccountType=All";
}
@@ -150,7 +150,7 @@
<span class="vatEnabled"><Swarmops5:CurrencyAmount runat="server" ID="CurrencyVat" /></span>
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextPurpose" /></div>
<div class="stacked-input-control"><asp:TextBox runat="server" ID="TextDueDate" /></div>
<Swarmops5:ComboBudgets ID="ComboBudgets" runat="server" />
<Swarmops5:ComboBudgets ID="ComboBudgets" runat="server" ListType="InvoiceableIn" />
<asp:Repeater ID="RepeaterTagDrop" runat="server"><ItemTemplate><span id="SpanDropTags<%# Eval("TagSetId") %>"><select class="easyui-combotree" url="/Automation/Json-TransactionTagsTree.aspx?TagSetId=<%# Eval("TagSetId") %>" name="DropTags<%# Eval("TagSetId") %>" id="DropTags<%# Eval("TagSetId") %>" animate="true" style="width:300px"></select></span>&nbsp;<br/></ItemTemplate></asp:Repeater>
<div class="stacked-input-control"></div> <!-- placeholder for label-side H2 -->