From fed3b1c77d33625f4f48d78abe2b85bd19421791 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Tue, 2 Jan 2018 21:50:46 +0100 Subject: [PATCH] Cosmetics --- Logic/Financial/VatReport.cs | 21 +++++++++ .../Pages.Ledgers.designer.cs | 45 +++++++++++++++++++ Site/App_GlobalResources/Pages.Ledgers.resx | 17 +++++++ Site/Pages/v5/Ledgers/InspectLedgers.aspx | 4 +- .../v5/Ledgers/Json-GeneralLedgerData.aspx.cs | 30 ++++++++++++- 5 files changed, 113 insertions(+), 4 deletions(-) diff --git a/Logic/Financial/VatReport.cs b/Logic/Financial/VatReport.cs index 5f2973b7..1b590b62 100644 --- a/Logic/Financial/VatReport.cs +++ b/Logic/Financial/VatReport.cs @@ -278,6 +278,27 @@ namespace Swarmops.Logic.Financial } } + public string DescriptionShort + { + get + { + switch (MonthCount) + { + case 1: + return String.Format("{0:MMM yyyy}", + new DateTime(YearMonthStart / 100, YearMonthStart % 100, 2)); + case 12: + return String.Format("{0}", + YearMonthStart / 100); + default: + DateTime start = new DateTime(YearMonthStart / 100, YearMonthStart % 100, 2); + + return String.Format("{0:MMM}-{1:MMM yyyy}", + start, start.AddMonths(MonthCount - 1)); + } + } + } + private new int OpenTransactionId { get diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs index 1d5bda19..df3e4284 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs +++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs @@ -1437,6 +1437,51 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to This transaction closes the VAT report for {0}.. + /// + internal static string InspectLedgers_TxInfo_CloseVatReport { + get { + return ResourceManager.GetString("InspectLedgers_TxInfo_CloseVatReport", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This transaction opens the VAT report for {0}.. + /// + internal static string InspectLedgers_TxInfo_OpenVatReport { + get { + return ResourceManager.GetString("InspectLedgers_TxInfo_OpenVatReport", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This transaction receives payment for Outbound Invoice #{0:N0}.. + /// + internal static string InspectLedgers_TxInfo_PaymentInvoice { + get { + return ResourceManager.GetString("InspectLedgers_TxInfo_PaymentInvoice", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This transaction pays {0}.. + /// + internal static string InspectLedgers_TxInfo_PayoutGeneric { + get { + return ResourceManager.GetString("InspectLedgers_TxInfo_PayoutGeneric", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This transaction pays Inbound Invoice #{0:N0} from {1}.. + /// + internal static string InspectLedgers_TxInfo_PayoutInvoice { + get { + return ResourceManager.GetString("InspectLedgers_TxInfo_PayoutInvoice", resourceCulture); + } + } + /// /// Looks up a localized string similar to Transaction is <span class="spanAnnoyingBlink">UNBALANCED:</span> missing amount. /// diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx index 842cfeb2..eee777a7 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.resx +++ b/Site/App_GlobalResources/Pages.Ledgers.resx @@ -959,4 +959,21 @@ General Ledger for This phrase is followed by dropdowns for year and month + + This transaction closes the VAT report for {0}. + {0} will be a time period, like "Jan 2017". + + + This transaction opens the VAT report for {0}. + {0} will be a time period, like "Jan 2017". + + + This transaction receives payment for Outbound Invoice #{0:N0}. + + + This transaction pays {0}. + + + This transaction pays Inbound Invoice #{0:N0} from {1}. + \ No newline at end of file diff --git a/Site/Pages/v5/Ledgers/InspectLedgers.aspx b/Site/Pages/v5/Ledgers/InspectLedgers.aspx index e6f01402..6b6b300e 100644 --- a/Site/Pages/v5/Ledgers/InspectLedgers.aspx +++ b/Site/Pages/v5/Ledgers/InspectLedgers.aspx @@ -401,10 +401,10 @@ + idField="id" treeField="idDisplay"> - + diff --git a/Site/Pages/v5/Ledgers/Json-GeneralLedgerData.aspx.cs b/Site/Pages/v5/Ledgers/Json-GeneralLedgerData.aspx.cs index b7e5ae5b..4d104ec2 100644 --- a/Site/Pages/v5/Ledgers/Json-GeneralLedgerData.aspx.cs +++ b/Site/Pages/v5/Ledgers/Json-GeneralLedgerData.aspx.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Linq; using System.Text; using Swarmops.Common.Enums; +using Swarmops.Common.Interfaces; using Swarmops.Logic.Financial; using Swarmops.Logic.Security; using Swarmops.Logic.Support; @@ -139,13 +140,38 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers } result.Append("{" + String.Format( - "\"id\":\"{0:N0}\",\"datetime\":\"{1:MMM-dd HH:mm}\",\"txDescription\":\"{2}\",\"action\":\"{3}\"," + + "\"id\":\"{0:N0}\",\"idDisplay\":\"{0:N0}\",\"datetime\":\"{1:MMM-dd HH:mm}\",\"txDescription\":\"{2}\",\"action\":\"{3}\"," + "\"state\":\"open\",\"children\":[", row.Transaction.OrganizationSequenceId, row.TransactionDateTime, JsonSanitize(description), JsonSanitize(actionHtml))); + if (transaction.Dependency != null) + { + IHasIdentity dependency = transaction.Dependency; + string info = string.Empty; + Documents docs = null; + + if (dependency is VatReport) + { + VatReport report = (VatReport) dependency; + if (report.OpenTransactionId == transaction.Identity) + { + info = String.Format(Resources.Pages.Ledgers.InspectLedgers_TxInfo_OpenVatReport, + report.DescriptionShort); + } + else if (report.CloseTransactionId == transaction.Identity) + { + info = String.Format(Resources.Pages.Ledgers.InspectLedgers_TxInfo_CloseVatReport, + report.DescriptionShort); + } + } + + // TODO: Continue here with adding Info row under transactions where it's helpful + // TODO: Remember that the Info row needs cell merging, colspan=5 or =6 + } + /* result.Append("{" + String.Format( @@ -225,7 +251,7 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers } result.Append ("{" + String.Format ( - "\"id\":\"{0:N0}-{6:N0}\",\"datetime\":\"{1}\",\"txDescription\":\"{2}\"," + + "\"id\":\"{0:N0}-{6:N0}\",\"idDisplay\":\"{0:N0}:{6:N0}\",\"datetime\":\"{1}\",\"txDescription\":\"{2}\"," + "\"deltaPos\":\"{3}\",\"deltaNeg\":\"{4}\",\"balance\":\"{5:N2}\"", row.Transaction.OrganizationSequenceId, JsonSanitize (accountClass),