diff --git a/Basic/Basic.csproj b/Basic/Basic.csproj
index 16f0fe44..b4f7ca60 100644
--- a/Basic/Basic.csproj
+++ b/Basic/Basic.csproj
@@ -58,6 +58,7 @@
+
diff --git a/Basic/Types/Common/ReportRequirement.cs b/Basic/Types/Common/ReportRequirement.cs
new file mode 100644
index 00000000..52bff3b8
--- /dev/null
+++ b/Basic/Types/Common/ReportRequirement.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Swarmops.Basic.Types.Common
+{
+ public enum ReportRequirement
+ {
+ Unknown = 0,
+ ///
+ /// a report (of the discussed type) is required for this time period
+ ///
+ Required,
+ ///
+ /// a report (of the discussed type) is NOT required for this time period
+ ///
+ NotRequired,
+ ///
+ /// A report (of the discussed type) has already been completed for this time period
+ ///
+ Completed
+ }
+}
diff --git a/Logic/Financial/ExternalBankData.cs b/Logic/Financial/ExternalBankData.cs
index f3b8920f..79efd987 100644
--- a/Logic/Financial/ExternalBankData.cs
+++ b/Logic/Financial/ExternalBankData.cs
@@ -16,10 +16,17 @@ namespace Swarmops.Logic.Financial
public ExternalBankDataProfile Profile { get; set; }
public ExternalBankDataRecord[] Records { get; private set; }
- public void LoadData (TextReader reader, Organization organization, Currency expectedCurrency)
+ public void LoadData (TextReader textReader, FinancialAccount automatedAccount)
{
+ /*
+
+ CsvHelper.Configuration.Configuration config = new CsvHelper.Configuration.Configuration();
+ config.HasHeaderRecord = true;
+
+ CsvReader csvReader = new CsvReader(textReader, config);
+
string data = reader.ReadToEnd();
- LoadData (data, organization, expectedCurrency);
+ LoadData (data, organization, expectedCurrency);*/
}
public void LoadData (string data, Organization organization, Currency accountCurrency)
diff --git a/Logic/Financial/VatReport.cs b/Logic/Financial/VatReport.cs
index 42a067c8..1ea4633d 100644
--- a/Logic/Financial/VatReport.cs
+++ b/Logic/Financial/VatReport.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
+using Swarmops.Basic.Types.Common;
using Swarmops.Basic.Types.Financial;
using Swarmops.Common.Enums;
using Swarmops.Common.Interfaces;
@@ -61,6 +62,69 @@ namespace Swarmops.Logic.Financial
return FromIdentityAggressive(vatReportId);
}
+ public static ReportRequirement IsRequired(Organization organization, int year, int month)
+ {
+ // If org isn't VAT enabled, the report is never required
+
+ if (!organization.VatEnabled)
+ {
+ return ReportRequirement.NotRequired;
+ }
+
+ DateTime nowUtc = DateTime.UtcNow;
+ int reportMonthInterval = organization.VatReportFrequencyMonths;
+
+ // Get the list of previous VAT reports
+
+ VatReports reports = VatReports.ForOrganization(organization, true);
+
+ if (reports.Count == 0)
+ {
+ DateTime firstReportGenerationTime =
+ new DateTime(organization.FirstFiscalYear, 1, 1).AddMonths(reportMonthInterval); // construct VAT report on the first day of the new month
+
+ if (nowUtc > firstReportGenerationTime)
+ {
+ // It's time to generate the first report
+ return ReportRequirement.Required;
+ }
+
+ }
+ else // if reports.Count > 0
+ {
+ reports.Sort(VatReports.VatReportSorterByDate);
+
+ DateTime lastReport = new DateTime(reports.Last().YearMonthStart / 100, reports.Last().YearMonthStart % 100,
+ 1);
+
+
+ // If we generated a report in the present month, say we've done so already
+ if (lastReport.Year == nowUtc.Year && lastReport.Month == nowUtc.Month)
+ {
+ return ReportRequirement.Completed;
+ }
+
+ // Check when the next report is due
+ DateTime nextReport = lastReport.AddMonths(reportMonthInterval);
+ DateTime nextReportGenerationTime = nextReport.AddMonths(reportMonthInterval);
+
+ if (nowUtc > nextReportGenerationTime)
+ {
+ // Time for a new report
+ return ReportRequirement.Required;
+ }
+
+ // Otherwise, it looks like this is a month we don't need to make a VAT report
+ // (the reporting interval may be set to quarterly or annually)
+ return ReportRequirement.NotRequired;
+ }
+
+ // Not yet time for the first report
+ return ReportRequirement.NotRequired;
+
+ }
+
+
public static VatReport Create(Organization organization, int year, int startMonth, int monthCount)
{
VatReport newReport = CreateDbRecord(organization, year, startMonth, monthCount);
diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj
index 31bda0c3..b1dcad10 100644
--- a/Logic/Logic.csproj
+++ b/Logic/Logic.csproj
@@ -491,7 +491,7 @@
-
+
diff --git a/Logic/UITests/Sockets.cs b/Logic/UITests/SocketTests.cs
similarity index 69%
rename from Logic/UITests/Sockets.cs
rename to Logic/UITests/SocketTests.cs
index 022cae78..e124bca0 100644
--- a/Logic/UITests/Sockets.cs
+++ b/Logic/UITests/SocketTests.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Swarmops.Logic.UITests
{
- public class Sockets: IUITestGroup
+ public class SocketTests: IUITestGroup
{
public string GroupId { get { return "Sockets"; } }
@@ -14,7 +14,20 @@ namespace Swarmops.Logic.UITests
public void InitializeServerSide() { }
- public string JavaScriptClientCodeDocReady { get { return string.Empty; } }
+ public string JavaScriptClientCodeDocReady { get { return @"
+
+ function pageOnHeartbeat(source) { // called from Swarmops-v5.js script
+ onUITestPassed('Sockets-Browser');
+ if (source == 'Frontend') {
+ onUITestPassed('Sockets-Frontend');
+ }
+ else if (source == 'Backend') {
+ onUITestPassed('Sockets-Backend');
+ }
+ }
+
+ "; } }
+
public IUITest[] Tests
{
get
@@ -33,7 +46,7 @@ namespace Swarmops.Logic.UITests
{
public string Id { get { return @"Browser"; } }
- public string Name { get { return @"Browser WebSocket connection"; } }
+ public string Name { get { return @"Browser WebSocket connection to server"; } }
public void ExecuteServerSide()
{
diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs
index 2a1fb741..48de4865 100644
--- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs
+++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs
@@ -2267,7 +2267,7 @@ namespace Resources.Pages {
}
///
- /// Looks up a localized string similar to You're viewing a filed VAT report. The inbound and outbound VAT, as well as total turnover, has been recorded for the report period. This report is ready to be transmitted to tax authorities..
+ /// Looks up a localized string similar to You're viewing a filed VAT report. The inbound and outbound VAT, as well as total turnover, have been recorded for the report period. This report is ready to be transmitted to tax authorities..
///
internal static string ViewVatReports_Info {
get {
diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx
index b1c7775f..7027da19 100644
--- a/Site/App_GlobalResources/Pages.Ledgers.resx
+++ b/Site/App_GlobalResources/Pages.Ledgers.resx
@@ -883,7 +883,7 @@
Turnover
- You're viewing a filed VAT report. The inbound and outbound VAT, as well as total turnover, has been recorded for the report period. This report is ready to be transmitted to tax authorities.
+ You're viewing a filed VAT report. The inbound and outbound VAT, as well as total turnover, have been recorded for the report period. This report is ready to be transmitted to tax authorities.
VAT Reports
diff --git a/Site/Pages/v5/Admin/Troubleshooting/Sockets.aspx b/Site/Pages/v5/Admin/Diagnostics.aspx
similarity index 90%
rename from Site/Pages/v5/Admin/Troubleshooting/Sockets.aspx
rename to Site/Pages/v5/Admin/Diagnostics.aspx
index e8b69ba3..4fe6d95d 100644
--- a/Site/Pages/v5/Admin/Troubleshooting/Sockets.aspx
+++ b/Site/Pages/v5/Admin/Diagnostics.aspx
@@ -1,4 +1,4 @@
-<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.Admin.Troubleshooting.DebugSockets" Codebehind="Sockets.aspx.cs" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.Admin.Diagnostics" Codebehind="Diagnostics.aspx.cs" %>
@@ -14,6 +14,8 @@
$(document).ready(function () {
+ <%=this.JavascriptDocReady%>
+
$('#TableTestResults').datagrid('appendRow', {
testGroupName: '',
testId: 'Group'
@@ -53,30 +55,21 @@
<%=this.ProgressTests.ClientID%>_show();
});
-
- function pageOnHeartbeat(source) { // called from Swarmops-v5.js script
- testPassed('Sockets-Browser');
- if (source == 'Frontend') {
- testPassed('Sockets-Frontend');
- }
- else if (source == 'Backend') {
- testPassed('Sockets-Backend');
- }
- }
-
- function testPassed(testId)
+ function onUITestPassed(testId)
{
$('img.test-running[data-test-id="' + testId + '"').fadeOut();
$('img.test-passed[data-test-id="' + testId + '"').show();
}
- function testFailed(testId)
+ function onUITestFailed(guid, testId)
{
$('img.test-passed[data-test-id="' + testId + '"').fadeOut();
$('img.test-running[data-test-id="' + testId + '"').fadeOut();
$('img.test-failed[data-test-id="' + testId + '"').show();
}
+ var uiTestPageGuid = '<%=this.PageGuid%>';
+
+
+
+
+
+
+
+
+
+ End-of-Month routine
+
+
+
+
+ | Group |
+ Todo |
+ Docs |
+ Actions |
+
+
+
+
+
+
+
diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs
new file mode 100644
index 00000000..b870806a
--- /dev/null
+++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace Swarmops.Frontend.Pages.Ledgers
+{
+ public partial class EndOfMonth : PageV5Base
+ {
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs
new file mode 100644
index 00000000..c6e08d21
--- /dev/null
+++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.designer.cs
@@ -0,0 +1,15 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Swarmops.Frontend.Pages.Ledgers {
+
+
+ public partial class EndOfMonth {
+ }
+}
diff --git a/Site/Site.csproj b/Site/Site.csproj
index 83c0b60e..cb064e77 100644
--- a/Site/Site.csproj
+++ b/Site/Site.csproj
@@ -609,6 +609,13 @@
OrgFunctions.aspx
+
+ UITests.aspx
+ ASPXCodeBehind
+
+
+ UITests.aspx
+
AjaxToggleSlider.ascx
ASPXCodeBehind
@@ -672,12 +679,12 @@
CommenceImpersonation.aspx
-
- Sockets.aspx
+
+ Diagnostics.aspx
ASPXCodeBehind
-
- Sockets.aspx
+
+ Diagnostics.aspx
PopulateCountry1.aspx
@@ -945,6 +952,13 @@
DebugLedgers.aspx
+
+ EndOfMonth.aspx
+ ASPXCodeBehind
+
+
+ EndOfMonth.aspx
+
InspectLedgers.aspx
ASPXCodeBehind
@@ -1273,6 +1287,7 @@
+
@@ -1670,7 +1685,7 @@
-
+
@@ -1709,6 +1724,7 @@
+