diff --git a/Database/Database-Financials.cs b/Database/Database-Financials.cs index 01357896..9cb07438 100644 --- a/Database/Database-Financials.cs +++ b/Database/Database-Financials.cs @@ -192,7 +192,8 @@ namespace Activizr.Database } } - public double GetFinancialAccountBalanceTotal (int financialAccountId) + [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] + public double GetFinancialAccountBalanceTotal(int financialAccountId) { using (DbConnection connection = GetMySqlDbConnection()) { @@ -215,7 +216,30 @@ namespace Activizr.Database } } - public Int64 GetFinancialAccountBalanceDeltaCents (int financialAccountId, DateTime startDate, DateTime endDate) + public Int64 GetFinancialAccountBalanceTotalCents(int financialAccountId) + { + using (DbConnection connection = GetMySqlDbConnection()) + { + connection.Open(); + + DbCommand command = + GetDbCommand( + "SELECT Sum(AmountCents) FROM FinancialTransactionRows WHERE FinancialAccountId=" + + financialAccountId + ";", connection); + + using (DbDataReader reader = command.ExecuteReader()) + { + if (reader.Read()) + { + return reader.GetInt64(0); + } + + throw new ArgumentException("Unknown Account Id"); + } + } + } + + public Int64 GetFinancialAccountBalanceDeltaCents(int financialAccountId, DateTime startDate, DateTime endDate) { using (DbConnection connection = GetMySqlDbConnection()) { @@ -281,6 +305,7 @@ namespace Activizr.Database } } + [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] public decimal GetFinancialAccountBalanceDelta(int financialAccountId, DateTime startDate, DateTime endDate) { return GetFinancialAccountBalanceDeltaCents(financialAccountId, startDate, endDate)/100.0m; diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index f2171c8d..0547b70c 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -16,11 +16,17 @@ namespace Activizr.Logic.Financial { } + [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] public double BalanceTotal { get { return PirateDb.GetDatabase().GetFinancialAccountBalanceTotal(Identity); } } + public Int64 BalanceTotalCents + { + get { return PirateDb.GetDatabase().GetFinancialAccountBalanceTotalCents(Identity); } + } + public static FinancialAccount FromIdentity (int identity) { return FromBasic(PirateDb.GetDatabase().GetFinancialAccount(identity)); @@ -31,6 +37,7 @@ namespace Activizr.Logic.Financial return new FinancialAccount(basic); } + [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] public decimal GetDelta(DateTime start, DateTime end) { return PirateDb.GetDatabase().GetFinancialAccountBalanceDelta(Identity, start, end); @@ -53,7 +60,8 @@ namespace Activizr.Logic.Financial return FinancialAccountRows.FromArray(basicRows); } - public double GetBudget (int year) + [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] + public double GetBudget(int year) { return PirateDb.GetDatabase().GetFinancialAccountBudget(this.Identity, year); } @@ -68,7 +76,8 @@ namespace Activizr.Logic.Financial return PirateDb.GetDatabase().GetFinancialAccountBudgetMonthly(this.Identity, year); } - public void SetBudget (int year, double amount) + [Obsolete("This method uses floating point for financials. Deprecated. Do not use.")] + public void SetBudget(int year, double amount) { PirateDb.GetDatabase().SetFinancialAccountBudget(this.Identity, year, amount); } diff --git a/Logic/Financial/ImportedBankData.cs b/Logic/Financial/ImportedBankData.cs new file mode 100644 index 00000000..2337fa93 --- /dev/null +++ b/Logic/Financial/ImportedBankData.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Activizr.Logic.Financial +{ + public class ImportedBankData + { + public double CurrentBalance; + public Int64 CurrentBalanceCents; + public List Rows; + } + + public class ImportedBankRow + { + public DateTime DateTime; + public string HashBase; + public string SuppliedTransactionId; + public Int64 CurrentBalanceCents; + public double CurrentBalance; + public Int64 AmountCentsNet; + public Int64 AmountCentsGross; + public double Fee; + public string Comment; + }; +} \ No newline at end of file diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 772f1684..cc1d5233 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -64,6 +64,7 @@ + diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index f52bef46..e46ea8a6 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Bank Screenshot + Displayed as header above modally zoomed screenshot + </p><p>(The most recent data in Activizr in <em>{0}</em> is from {1:yyyy-MMM-dd}. You should download bank data from at least <strong>{2:yyyy-MMM-dd}.</strong>) Displayed to help user determine scope of bank download @@ -130,9 +134,29 @@ Header above instructions for generation of the bank file type selected. - Open SEB's internet bank. Go to <strong>your account</strong>, and enter the date span you wish to download in the search box. Press <strong>filter</strong>. After that, click the link to <strong>save the account history</strong>. A popup will appear. Choose <strong>csv</strong> and <strong>tab separated</strong>, then <strong>save</strong>. The downloaded file will be named <em>kontohandelser.csv</em>. + Open SEB's internet bank. Go to <strong>your account</strong>, and enter the date span you wish to download in the search box. Press <strong>filter</strong>. After that, click the link to <strong>save the account history</strong>. A popup will appear. Choose <strong>csv</strong> and <strong>tab separated</strong>, then <strong>save</strong>. The downloaded file will be named <em>Kontohändelser.csv</em>. Only translate to languages where SEB is active. + + <p>The file contained {0:N0} transactions. <strong>{1:N0} transactions</strong> have been successfully imported into the <em>{2}</em> bookkeeping account. ({3:N0} transactions were duplicates.)</p><p><strong>However, the bank balance does not match the records in Activizr.</strong> This is usually due to missing transactions. Please upload a transaction list with a larger time span to make sure that Activizr sees all transactions.</p><p>Activizr's bookkeeping account is currently <strong>not in sync</strong> with that of the bank.</p> + + + <h3>The bank file could not be imported.</h3><p>This has one of three reasons: you missed some detail in the download instructions, the bank has changed its format, or you accidentally uploaded the wrong file entirely (like a photo from your last party instead of the transactions list). No transactions were imported at all. <strong>Please retry.</strong> + + + File Successfully Imported + Displayed as header after successful processing + + + File Imported, But Data Out Of Sync + + + Error on importing file + Displayed as header on import failure + + + <p>The file contained {0:N0} transactions. <strong>{1:N0} transactions</strong> have been successfully imported into the <em>{2}</em> bookkeeping account. ({3:N0} transactions were duplicates.)</p><p>After import, the account balance in Activizr matches that of the bank.</p> + Here, you can upload files from your bank or payment provider into your organization's bookkeeping. Examples include account history and payments received. Displayed in sidebar on page. @@ -152,6 +176,10 @@ Select Bank File Type Header above several bank logos, prompting a selection of bank. + + Upload another bank file? + Displayed as link + Upload Bank File Displayed as header above download instructions / upload form diff --git a/Site5/Images/Ledgers/uploadbankfiles-seb-bankgirofil-small.png b/Site5/Images/Ledgers/uploadbankfiles-seb-bankgirofil-small.png index 5aa900bc..9c4c1e8f 100644 Binary files a/Site5/Images/Ledgers/uploadbankfiles-seb-bankgirofil-small.png and b/Site5/Images/Ledgers/uploadbankfiles-seb-bankgirofil-small.png differ diff --git a/Site5/Images/Ledgers/uploadbankfiles-seb-kontoutdrag-small.png b/Site5/Images/Ledgers/uploadbankfiles-seb-kontoutdrag-small.png index b7912b5a..12be2ef1 100644 Binary files a/Site5/Images/Ledgers/uploadbankfiles-seb-kontoutdrag-small.png and b/Site5/Images/Ledgers/uploadbankfiles-seb-kontoutdrag-small.png differ diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx index fcdfb7de..11ffe926 100644 --- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx +++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx @@ -133,8 +133,12 @@ div.BankUploadInstructionsImage -

-

Todo...

+

+ + + + +