diff --git a/Database/Database-Documents.cs b/Database/Database-Documents.cs index 893b7aa0..80f0315a 100644 --- a/Database/Database-Documents.cs +++ b/Database/Database-Documents.cs @@ -166,7 +166,24 @@ namespace Swarmops.Database } - public void SetDocumentForeignObject (int documentId, DocumentType newDocumentType, int newForeignId) + public void SetDocumentDescription(int documentId, string newDescription) + { + using (DbConnection connection = GetMySqlDbConnection()) + { + connection.Open(); + + DbCommand command = GetDbCommand("SetDocumentDescription", connection); + command.CommandType = CommandType.StoredProcedure; + + AddParameterWithName(command, "documentId", documentId); + AddParameterWithName(command, "newDescription", newDescription); + + command.ExecuteNonQuery(); + } + } + + + public void SetDocumentForeignObject(int documentId, DocumentType newDocumentType, int newForeignId) { using (DbConnection connection = GetMySqlDbConnection()) { diff --git a/Logic/Structure/Organization.cs b/Logic/Structure/Organization.cs index 5cb9545e..bd851000 100644 --- a/Logic/Structure/Organization.cs +++ b/Logic/Structure/Organization.cs @@ -794,6 +794,26 @@ namespace Swarmops.Logic.Structure } } + public FinancialAccounts FinancialAccountsExternal + { + get + { + // HACK: MUST FETCH THIS FROM ACTUAL ACCOUNTS + // HACK HACK HACK HACK HACK HACK + + if (Organization.FromIdentity(1).Name == "Piratpartiet SE") // also, fetch that from installation id instead + { + FinancialAccounts result = new FinancialAccounts(); + result.Add(FinancialAccount.FromIdentity(1)); + result.Add(FinancialAccount.FromIdentity(2)); + + return result; + } + + throw new NotImplementedException(); + } + } + public static Organization Create (int parentOrganizationId, string nameInternational, string name, string nameShort, string domain, string mailPrefix, int anchorGeographyId, bool acceptsMembers, bool autoAssignNewMembers, int defaultCountryId) { @@ -851,6 +871,7 @@ namespace Swarmops.Logic.Structure public string IncomingPaymentTag { + // HACK: REmove this property altogether - should be per account get { return "bg 451-0061 "; } // TODO: Per organization, of course } diff --git a/Logic/Support/Document.cs b/Logic/Support/Document.cs index 96f7fafc..9d621bb8 100644 --- a/Logic/Support/Document.cs +++ b/Logic/Support/Document.cs @@ -134,6 +134,9 @@ namespace Swarmops.Logic.Support // Unlink, actually SetForeignObject(new TemporaryIdentity(0)); + File.Delete(StorageRoot + ServerFileName); + SwarmDb.GetDatabaseForWriting().SetDocumentDescription(this.Identity, "Deleted"); + } protected static string StorageRoot diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index 363726a6..7cc42cca 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -354,12 +354,12 @@ Displayed when the input file can't be parsed, before import attempt. - <p>The file has been <strong>successfully imported.</strong> {0:N} new transactions imported; {1:N} discarded as duplicates of what was already in Swarmops. The account balance in Swarmops matches that of the bank.</p><p>The file contained transactions from {2:yyyy-MMM-dd} to {3:yyyy-MMM-dd}.</p> + <p>The file has been <strong>successfully imported.</strong> {0:N0} new transactions imported; {1:N0} discarded as duplicates of what was already in Swarmops. The account balance in Swarmops matches that of the bank.</p><p>The file contained transactions from {2:yyyy-MMM-dd} to {3:yyyy-MMM-dd}.</p> Zero is new transaction count, one is duplicate transaction count, two and three are lowest and highest dates found in file. Pay attention to date format and adjust to culture. - <p>The file was imported, but the <strong>resulting account balance mismatches.</strong></p><p>After importing {0:N} transactions (and discarding {1:N} duplicates), the entire file has been processed. However, the resulting account balance in Swarmops is not the same as that of the bank statement.</p> -<p>Please try uploading a fresh account statement. If that still produces a mismatch, you may need to try <a href="/Pages/v5/Ledgers/ResyncExternalAccount.aspx">resynchronizing</a>the bank account with a comprehensive account statement file.</p> + <p>The file was imported, but the <strong>resulting account balance mismatches.</strong></p><p>After importing {0:N0} transactions (and discarding {1:N0} duplicates), the entire file has been processed. However, the resulting account balance in Swarmops is not the same as that of the bank statement.</p> +<p>Please try uploading a fresh account statement. If that still produces a mismatch, you may need to try <a href="/Pages/v5/Ledgers/ResyncExternalAccount.aspx">resynchronizing</a> the bank account with a comprehensive account statement file.</p> Displayed on successful import, but the resulting balance is off compared to the account statement file that was just uploaded. diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx index 61acd688..743b1de3 100644 --- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx +++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx @@ -29,6 +29,17 @@ if (selectedAccountId != 0) { $('#<%=this.UploadFile.ClientID %>_ButtonUploadVisible').fadeIn(); + + $.ajax({ + type: "POST", + url: "UploadBankFiles.aspx/GetAccountUploadInstructions", + data: "{'guid': '<%= this.UploadFile.GuidString %>', 'accountIdString':'" + $('#<%= this.DropAccounts.ClientID %>').val() + "'}", + contentType: "application/json; charset=utf-8", + dataType: "json", + success: function (msg) { + $('#SpanInstructions').text(msg.d); + } + }); } else { $('#<%=this.UploadFile.ClientID %>_ButtonUploadVisible').fadeOut(); } @@ -41,6 +52,7 @@ $('#DivProgressProcessing').progressbar({ value: 0, max: 100 }); $('#DivProgressFake').progressbar({ value: 0, max: 100 }); $('#DivProgressFake').progressbar({ value: 100 }); // this guy is swapped in on completion + $('#DivProcessingFake').slideUp(); // in case second, third... file halfway = false; $.ajax({ @@ -70,13 +82,40 @@ width: "100%" }, { queue: false }); $('#DivProcessing').hide(); - $('#DivProcessingFake').show(); + $('#DivProgressProcessingFake').show(); + $('#DivProcessingFake').show(); - // Add processing results here + $.ajax({ + type: "POST", + url: "UploadBankFiles.aspx/GetReportedImportResults", + data: "{'guid': '<%= this.UploadFile.GuidString %>'}", + contentType: "application/json; charset=utf-8", + dataType: "json", + success: function (msg2) { + $('#DivUploadResultsGood').hide(); + $('#DivUploadResultsBad').hide(); + $('#DivUploadResultsQuestionable').hide(); + + $('#DivUploadResults' + msg2.d.Category + 'Text').html(msg2.d.Html); + $('#DivUploadResults' + msg2.d.Category).show(); + + $('#<%=this.UploadFile.ClientID %>_ButtonUploadVisible').hide(); + + $('#SpanUploadMore').show(); + $('#SpanUploadFirst').hide(); + $('#<%=DropAccounts.ClientID %>').val('0'); + $('#SpanInstructions').text(''); + setTimeout("$('#DivProgressFake').slideUp().fadeOut();", 1000); + setTimeout("$('#DivUploadBankFile').slideDown();", 1000); + + } + }); + } else { if (msg.d > 50 && !halfway) { halfway = true; + $('#DivProgressFake').show(); // hidden if 2nd, 3rd... file $('#DivUploadBankFile').slideUp().fadeOut(); } @@ -93,18 +132,6 @@ if (msg.d > 0 && !progressReceived) { progressReceived = true; - $.ajax({ - type: "POST", - url: "UploadBankFiles.aspx/GetProcessingStatistics", - data: "{'guid': '<%= this.UploadFile.GuidString %>'}", - contentType: "application/json; charset=utf-8", - dataType: "json", - success: function (msg2) {/* - $('#SpanFirstTx').text(msg2.d.FirstTransaction); - $('#SpanLastTx').text(msg2.d.LastTransaction); - $('#SpanTxCount').text(msg2.d.TransactionCount);*/ - } - }); } setTimeout('updateProgressProcessing();', 1000); @@ -123,31 +150,31 @@ -