From 508d383d53704acfaf305d01d10cd91ef6939dad Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 30 Dec 2017 15:36:00 +0100 Subject: [PATCH] Work on Direct Purchases --- Logic/Financial/FinancialTransaction.cs | 7 -- Logic/Support/Documents.cs | 12 ++++ .../Pages.Ledgers.designer.cs | 27 ++++++++ Site/App_GlobalResources/Pages.Ledgers.resx | 9 +++ .../Pages/v5/Ledgers/BalanceTransactions.aspx | 5 +- .../v5/Ledgers/BalanceTransactions.aspx.cs | 64 ++++++++++++++++++- 6 files changed, 113 insertions(+), 11 deletions(-) diff --git a/Logic/Financial/FinancialTransaction.cs b/Logic/Financial/FinancialTransaction.cs index c566e011..7ff1bf60 100644 --- a/Logic/Financial/FinancialTransaction.cs +++ b/Logic/Financial/FinancialTransaction.cs @@ -256,13 +256,6 @@ namespace Swarmops.Logic.Financial } } - [Obsolete ("Do not use double-precision methods. They leak cents. Use AddRow (FinancialAccount, Int64, Person).", - true)] - public void AddRow (FinancialAccount account, double amount, Person person) - { - AddRow (account, (Int64) (amount*100), person); - } - public FinancialTransactionRow AddRow (FinancialAccount account, Int64 amountCents, Person person) { return AddRow (account.Identity, amountCents, person != null ? person.Identity : 0); diff --git a/Logic/Support/Documents.cs b/Logic/Support/Documents.cs index 4e090974..840f563e 100644 --- a/Logic/Support/Documents.cs +++ b/Logic/Support/Documents.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Swarmops.Basic.Types; using Swarmops.Basic.Types.Structure; using Swarmops.Common.Interfaces; @@ -79,5 +80,16 @@ namespace Swarmops.Logic.Support doc.SetForeignObject (foreignObject); } } + + public Documents WhereNotAssociated + { + get + { + Documents result = new Documents(); + result.AddRange(this.Where(doc => doc.ForeignId == 0)); + + return result; + } + } } } \ No newline at end of file diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs index 36c5b9fa..41169126 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs +++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs @@ -501,6 +501,33 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to The transaction description cannot be empty.. + /// + internal static string BalanceTransactions_Error_NeedDescription { + get { + return ResourceManager.GetString("BalanceTransactions_Error_NeedDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The transaction needs a proof of purchase.. + /// + internal static string BalanceTransactions_Error_NeedDocumentation { + get { + return ResourceManager.GetString("BalanceTransactions_Error_NeedDocumentation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The VAT amount doesn't seem to be correctly entered.. + /// + internal static string BalanceTransactions_Error_VatAmountParseError { + get { + return ResourceManager.GetString("BalanceTransactions_Error_VatAmountParseError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Exact Matches For This Amount. /// diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx index 5764aa4e..b5aeb387 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.resx +++ b/Site/App_GlobalResources/Pages.Ledgers.resx @@ -920,6 +920,15 @@ Totals for this report Displayed as description of footer + + The transaction description cannot be empty. + + + The transaction needs a proof of purchase. + + + The VAT amount doesn't seem to be correctly entered. + Mark as Direct Purchase diff --git a/Site/Pages/v5/Ledgers/BalanceTransactions.aspx b/Site/Pages/v5/Ledgers/BalanceTransactions.aspx index 180279b2..d0c4c2fe 100644 --- a/Site/Pages/v5/Ledgers/BalanceTransactions.aspx +++ b/Site/Pages/v5/Ledgers/BalanceTransactions.aspx @@ -218,7 +218,8 @@ transactionId: transactionId, budgetId: budgetId, vatAmountString: vatAmount, - newDescription: txDescription + newDescription: txDescription, + guid: uploadGuid }, function(result) { if (result.Success) { @@ -246,6 +247,8 @@ var buttonVatReportValue = SwarmopsJS.unescape('<%=this.Localized_ButtonVatReport%>'); var buttonPurchaseValue = SwarmopsJS.unescape('<%=this.Localized_ButtonPurchase%>'); + var uploadGuid = '<%=this.UploadPurchase.GuidString%>'; +