Work on EOM checklist
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Swarmops.Common.Attributes;
|
||||
using Swarmops.Common.Enums;
|
||||
using Swarmops.Common.Interfaces;
|
||||
|
||||
@@ -38,14 +39,20 @@ namespace Swarmops.Basic.Types.Financial
|
||||
// empty copy ctor
|
||||
}
|
||||
|
||||
public int FinancialAccountDocumentId { get; private set; }
|
||||
public int FinancialAccountId { get; private set; }
|
||||
// Name-identical dbcolumns / properties
|
||||
|
||||
[DbColumnName] public int FinancialAccountDocumentId { get; private set; }
|
||||
[DbColumnName] public int FinancialAccountId { get; private set; }
|
||||
[DbColumnName] public DateTime UploadedDateTime { get; private set; }
|
||||
[DbColumnName] public int UploadedByPersonId { get; private set; }
|
||||
[DbColumnName] public DateTime ConcernsPeriodStart { get; private set; }
|
||||
[DbColumnName] public DateTime ConcernsPeriodEnd { get; private set; }
|
||||
[DbColumnName] public string RawDocumentText { get; private set; }
|
||||
|
||||
// Complex or renamed dbcolumns / properties
|
||||
|
||||
public FinancialAccountDocumentType Type { get; private set; }
|
||||
public DateTime UploadedDateTime { get; private set; }
|
||||
public int UploadedByPersonId { get; private set; }
|
||||
public DateTime ConcernsPeriodStart { get; private set; }
|
||||
public DateTime ConcernsPeriodEnd { get; private set; }
|
||||
public string RawDocumentText { get; private set; }
|
||||
|
||||
|
||||
public int Identity { get { return this.FinancialAccountDocumentId; } }
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Swarmops.Database
|
||||
connection.Open();
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand("SELECT" + paymentFieldSequence +
|
||||
GetDbCommand("SELECT" + financialAccountDocumentFieldSequence +
|
||||
"WHERE FinancialAccountDocumentId=" + financialAccountDocumentId,
|
||||
connection);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Swarmops.Database
|
||||
|
||||
DbCommand command =
|
||||
GetDbCommand(
|
||||
"SELECT" + paymentFieldSequence + ConstructWhereClause("Payments", conditions), connection);
|
||||
"SELECT" + financialAccountDocumentFieldSequence + ConstructWhereClause("Payments", conditions), connection);
|
||||
|
||||
using (DbDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
@@ -105,75 +105,13 @@ namespace Swarmops.Database
|
||||
AddParameterWithName(command, "uploadedByPersonId", uploadedByPersonId);
|
||||
AddParameterWithName(command, "concernsPeriodStart", concernsPeriodStart); // inclusive endpoint
|
||||
AddParameterWithName(command, "concernsPeriodEnd", concernsPeriodEnd); // exclusive endpoint
|
||||
AddParameterWithName(command, "outboundInvoiceId", outboundInvoiceId);
|
||||
AddParameterWithName(command, "rawDocumentText", rawText);
|
||||
|
||||
return Convert.ToInt32(command.ExecuteScalar());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int CreatePayment(int paymentGroupId, Int64 amountCents, string reference, string fromAccount,
|
||||
string key,
|
||||
bool hasImage, int outboundInvoiceId)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand("CreatePaymentPrecise", connection);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameterWithName(command, "paymentGroupId", paymentGroupId);
|
||||
AddParameterWithName(command, "amountCents", amountCents);
|
||||
AddParameterWithName(command, "reference", reference);
|
||||
AddParameterWithName(command, "fromAccount", fromAccount);
|
||||
AddParameterWithName(command, "paymentKey", key);
|
||||
AddParameterWithName(command, "hasImage", hasImage);
|
||||
AddParameterWithName(command, "outboundInvoiceId", outboundInvoiceId);
|
||||
|
||||
return Convert.ToInt32(command.ExecuteScalar());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int CreatePaymentInformation(int paymentId, PaymentInformationType type, string data)
|
||||
{
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand("CreatePaymentInformation", connection);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameterWithName(command, "paymentId", paymentId);
|
||||
AddParameterWithName(command, "dataTypeString", type.ToString());
|
||||
AddParameterWithName(command, "data", data);
|
||||
|
||||
return Convert.ToInt32(command.ExecuteScalar());
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("This should never be called, ever: it ruins trackability.")]
|
||||
public void DeletePayment(int paymentId)
|
||||
{
|
||||
// This function is necessary since the Swedish bank system only allows for a dupe check AFTER all payments
|
||||
// have been communicated, so they are created as data is received. If the data was a dupe, it is therefore
|
||||
// deleted after the dupecheck triggers.
|
||||
|
||||
// That code was later re-written to do in-memory dupechecking. This delete function should never be called.
|
||||
|
||||
using (DbConnection connection = GetMySqlDbConnection())
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
DbCommand command = GetDbCommand("DeletePayment", connection);
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
|
||||
AddParameterWithName(command, "paymentId", paymentId);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -154,21 +154,24 @@
|
||||
|
||||
SwarmopsJS.ajaxCall(
|
||||
"/Pages/v5/Ledgers/EndOfMonth.aspx/" + callbackFunction,
|
||||
{},
|
||||
$.proxy(function() {
|
||||
var groupId = $(this).attr('data-group');
|
||||
{ itemId: itemId },
|
||||
// Success function
|
||||
$.proxy(function (result) {
|
||||
var itemId = $(this).attr('data-item');
|
||||
|
||||
$('span.action-list-item[data-item="' + itemId + '"]').addClass('action-list-item-completed');
|
||||
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
|
||||
$('img.status-icon-completed[data-item="' + itemId + '"]').fadeIn();
|
||||
|
||||
var selector = ".action-list-item:not(.action-list-item-completed):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();
|
||||
if (result.Success) {
|
||||
markItemCompleted(itemId);
|
||||
} else {
|
||||
// Restore action icons.
|
||||
// Todo: display DisplayMessage in dialog or error notice.
|
||||
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
|
||||
$('img.action-icon[data-item="' + itemId + '"]').show();
|
||||
}
|
||||
}, this),
|
||||
// Failure (exception) function
|
||||
$.proxy(function () {
|
||||
var itemId = $(this).attr('data-item');
|
||||
$('img.status-icon-pleasewait[data-item="' + itemId + '"]').hide();
|
||||
$('img.action-icon[data-item="' + itemId + '"]').show();
|
||||
}, this)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -251,10 +251,9 @@ namespace Swarmops.Frontend.Pages.Ledgers
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static AjaxCallResult CreateVatReport()
|
||||
public static AjaxCallResult CreateVatReport(string itemId)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
if (!authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.BookkeepingDetails)))
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
@@ -266,6 +265,33 @@ namespace Swarmops.Frontend.Pages.Ledgers
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public static AjaxCallResult UploadBankStatement(string itemId)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
if (!authData.Authority.HasAccess(new Access(authData.CurrentOrganization, AccessAspect.BookkeepingDetails)))
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
string[] parts = itemId.Split('-');
|
||||
FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(parts[1]));
|
||||
int yearMonth = Int32.Parse(parts[2]);
|
||||
|
||||
if (account.OrganizationId != authData.CurrentOrganization.Identity)
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new AjaxCallResult {Success = true};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private class EomItem
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user