EOM should be functional to create VAT reports
This commit is contained in:
@@ -62,6 +62,43 @@ namespace Swarmops.Logic.Financial
|
||||
return FromIdentityAggressive(vatReportId);
|
||||
}
|
||||
|
||||
public static void CreateNext(Organization organization)
|
||||
{
|
||||
// Creates all VAT reports that are required up until today.
|
||||
// Normally this is just one, but in the case of a missed report slot, this function will
|
||||
// catch up with all the missed ones, too.
|
||||
|
||||
DateTime nowUtc = DateTime.UtcNow;
|
||||
DateTime nextReportDue = NextReportDue(organization);
|
||||
int reportMonthInterval = organization.VatReportFrequencyMonths;
|
||||
|
||||
if (nextReportDue > nowUtc)
|
||||
{
|
||||
throw new InvalidOperationException("VAT report is not yet due or has already been generated");
|
||||
}
|
||||
|
||||
DateTime thisReport = new DateTime(organization.FirstFiscalYear, 1, 1); // default to first report
|
||||
VatReports reports = VatReports.ForOrganization(organization, true);
|
||||
|
||||
if (reports.Count > 0)
|
||||
{
|
||||
reports.Sort(VatReports.VatReportSorterByDate);
|
||||
|
||||
DateTime lastReport = new DateTime(reports.Last().YearMonthStart / 100, reports.Last().YearMonthStart % 100,
|
||||
1);
|
||||
|
||||
thisReport = lastReport.AddMonths(reportMonthInterval);
|
||||
}
|
||||
|
||||
while (thisReport.AddMonths(reportMonthInterval) < nowUtc)
|
||||
{
|
||||
VatReport.Create(organization, thisReport.Year, thisReport.Month, reportMonthInterval);
|
||||
thisReport = thisReport.AddMonths(reportMonthInterval);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static ReportRequirement IsRequired(Organization organization)
|
||||
{
|
||||
// If org isn't VAT enabled, the report is never required
|
||||
|
||||
+1
-1
@@ -1150,7 +1150,7 @@ namespace Resources.Pages {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to End-of-Month Routine.
|
||||
/// Looks up a localized string similar to End-of-Month Routine: {0:MMMM yyyy}.
|
||||
/// </summary>
|
||||
internal static string EndOfMonth_Title {
|
||||
get {
|
||||
|
||||
@@ -1014,7 +1014,8 @@
|
||||
<comment>This means to match bank transactions with incoming/outgoing expected payments (invoices, expense reports, etc) where it couldn't be done automatically</comment>
|
||||
</data>
|
||||
<data name="EndOfMonth_Title" xml:space="preserve">
|
||||
<value>End-of-Month Routine</value>
|
||||
<value>End-of-Month Routine: {0:MMMM yyyy}</value>
|
||||
<comment>Parameter zero is the month that's just ended</comment>
|
||||
</data>
|
||||
<data name="EndOfMonth_UploadBankStatementFor" xml:space="preserve">
|
||||
<value>Upload Bank Statement ({1}) for {0} for {2}</value>
|
||||
|
||||
@@ -128,35 +128,36 @@
|
||||
|
||||
$('.action').click(function() {
|
||||
var itemId = $(this).attr('data-item');
|
||||
var callbackName = $(this).attr('data-callback');
|
||||
var callbackFunction = $(this).attr('data-callback');
|
||||
|
||||
$('img.action-icon[data-item="' + itemId + '"]').hide();
|
||||
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').show();
|
||||
|
||||
setTimeout($.proxy(function() {
|
||||
var groupId = $(this).attr('data-group');
|
||||
var itemId = $(this).attr('data-item');
|
||||
SwarmopsJS.ajaxCall(
|
||||
"EndOfMonth.aspx/" + callbackFunction,
|
||||
{},
|
||||
$.proxy(function() {
|
||||
var groupId = $(this).attr('data-group');
|
||||
var itemId = $(this).attr('data-item');
|
||||
|
||||
$('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-disabled');
|
||||
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
|
||||
$('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn();
|
||||
$('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-disabled');
|
||||
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
|
||||
$('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn();
|
||||
|
||||
$(this).attr('data-item');
|
||||
var selector = ".action-list-item:not(.action-list-item-disabled)[data-group='" + groupId + "']";
|
||||
if ($(selector).length == 0) // no further actions in this group enabled
|
||||
{
|
||||
// mark the group as completed
|
||||
$(".group-status-icon[data-group='" + groupId + "']").fadeIn();
|
||||
}
|
||||
}, this), 4000);
|
||||
$(this).attr('data-item');
|
||||
var selector = ".action-list-item:not(.action-list-item-disabled)[data-group='" + groupId + "']";
|
||||
if ($(selector).length == 0) // no further actions in this group enabled
|
||||
{
|
||||
// mark the group as completed
|
||||
$(".group-status-icon[data-group='" + groupId + "']").fadeIn();
|
||||
}
|
||||
}, this)
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Function: Generate VAT report
|
||||
|
||||
// Function: Match all mismatched transactions
|
||||
|
||||
// Function: Upload bank statement PDF for accountId x
|
||||
@@ -213,8 +214,8 @@
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.datagrid-row-selected,.datagrid-row-over,.datagrid-row-checked{
|
||||
background:transparent;
|
||||
.datagrid-row-selected, .datagrid-row-over, .datagrid-row-checked {
|
||||
background:transparent !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -228,7 +229,7 @@
|
||||
<h2>End-of-Month routine</h2>
|
||||
|
||||
<table id="TableEomItems" class="easyui-datagrid" style="width:680px;height:500px"
|
||||
data-options="rownumbers:false,singleSelect:false,nowrap:false,fit:false,loading:false,selectOnCheck:true,checkOnSelect:true"
|
||||
data-options="rownumbers:false,singleSelect:false,nowrap:false,fit:false,loading:false,selectOnCheck:false,checkOnSelect:false"
|
||||
idField="itemId">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -3,11 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Swarmops.Basic.Types.Common;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
|
||||
namespace Swarmops.Frontend.Pages.Ledgers
|
||||
{
|
||||
@@ -17,11 +19,12 @@ namespace Swarmops.Frontend.Pages.Ledgers
|
||||
{
|
||||
this.PageAccessRequired = new Access(this.CurrentOrganization, AccessAspect.BookkeepingDetails);
|
||||
|
||||
this.Title = Resources.Pages.Ledgers.EndOfMonth_Title;
|
||||
this.PageTitle =
|
||||
this.Title =
|
||||
String.Format(Resources.Pages.Ledgers.EndOfMonth_Title, DateTime.UtcNow.AddMonths(-1));
|
||||
|
||||
this.InfoBoxLiteral = Resources.Pages.Ledgers.EndOfMonth_Info;
|
||||
|
||||
// Check which reports are required
|
||||
|
||||
ItemGroups = new List<EomItemGroup>();
|
||||
@@ -118,6 +121,22 @@ namespace Swarmops.Frontend.Pages.Ledgers
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static AjaxCallResult CreateVatReport()
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (!authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.BookkeepingDetails)))
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
VatReport.CreateNext(authData.CurrentOrganization);
|
||||
|
||||
return new AjaxCallResult {Success = true};
|
||||
}
|
||||
|
||||
|
||||
private class EomItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user