From d9cf6067d0080a2b41daea4309b29a982c6ce82e Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 5 May 2018 16:02:31 +0200 Subject: [PATCH] Even more ready for pilot test --- .../Pages.Ledgers.designer.cs | 63 ++++++------------- Site/App_GlobalResources/Pages.Ledgers.resx | 23 +++---- Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs | 35 ++++++++--- 3 files changed, 53 insertions(+), 68 deletions(-) diff --git a/Site/App_GlobalResources/Pages.Ledgers.designer.cs b/Site/App_GlobalResources/Pages.Ledgers.designer.cs index 7e19eb6c..e0d86bb1 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.designer.cs +++ b/Site/App_GlobalResources/Pages.Ledgers.designer.cs @@ -1761,42 +1761,6 @@ namespace Resources.Pages { } } - /// - /// Looks up a localized string similar to Different banks have different means of obtaining the BGMAX format file. On SEB, you go to <strong>Payments</strong> and <strong>File communications</strong> to see a list of files to retrieve. Other banks will vary. In any case, upload them here.. - /// - internal static string UploadBankFiles_DownloadInstructions_BankgiroSEFile { - get { - return ResourceManager.GetString("UploadBankFiles_DownloadInstructions_BankgiroSEFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Log on to PayPal. Go to <strong>Your Account</strong>, and under the <strong>History</strong> menu, select <strong>Download History</strong>. Select <strong>Custom Date Range</strong>, enter the range since last download (as indicated) plus some overlap, and most importantly, select <strong>Tab Delimited - All Activity</strong>. Click <strong>Download</strong>.</p><p>Some time will pass before you get a mail from PayPal saying that the file is ready for download. It will be named <em>download.txt</em>. Uplo [rest of string was truncated]";. - /// - internal static string UploadBankFiles_DownloadInstructions_PaypalFile { - get { - return ResourceManager.GetString("UploadBankFiles_DownloadInstructions_PaypalFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Log on to Payson. Go to the <strong>History</strong> tab, and click <strong>Export history</strong>. The downloaded file will be named <em>Payson_Export_[date].xls</em>. Upload this file.. - /// - internal static string UploadBankFiles_DownloadInstructions_PaysonFile { - get { - return ResourceManager.GetString("UploadBankFiles_DownloadInstructions_PaysonFile", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 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>. Upload this file.. - /// - internal static string UploadBankFiles_DownloadInstructions_SebAccountFile { - get { - return ResourceManager.GetString("UploadBankFiles_DownloadInstructions_SebAccountFile", resourceCulture); - } - } - /// /// Looks up a localized string similar to <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 Swarmops.</strong> This is usually due to missing transactions. Please upload a transaction list with a larger time span to make sure that Swarmops sees all transactions.</p><p>Swarmops's bookkeeping account is currently <strong>not in sync</strong [rest of string was truncated]";. /// @@ -1860,15 +1824,6 @@ namespace Resources.Pages { } } - /// - /// Looks up a localized string similar to As this was the first upload to this automated account, the initial balance of {0} {1:N2} going into the year {2} has been detected and set.. - /// - internal static string UploadBankFiles_FirstUploadBalanceSet { - get { - return ResourceManager.GetString("UploadBankFiles_FirstUploadBalanceSet", resourceCulture); - } - } - /// /// Looks up a localized string similar to Error on importing file. /// @@ -2022,6 +1977,24 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to As this was the first upload to this automated account, the initial balance of <strong>{0} {1:N2}</strong> going into the year {2} has been detected and set . + /// + internal static string UploadBankFiles_ResultsInitialBalanceSet { + get { + return ResourceManager.GetString("UploadBankFiles_ResultsInitialBalanceSet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to (which was accounted for with <strong>{0} {1:N2}</strong> in the presentation currency). + /// + internal static string UploadBankFiles_ResultsInitialBalanceSetForeignCurrency { + get { + return ResourceManager.GetString("UploadBankFiles_ResultsInitialBalanceSetForeignCurrency", resourceCulture); + } + } + /// /// Looks up a localized string similar to <br/><p>The payments file was <strong>successfully imported.</strong> {1:N0} payment(s) in {0:N0} group(s), totalling {3} {2:N2}, were imported.</p>. /// diff --git a/Site/App_GlobalResources/Pages.Ledgers.resx b/Site/App_GlobalResources/Pages.Ledgers.resx index b2c70048..34de8e80 100644 --- a/Site/App_GlobalResources/Pages.Ledgers.resx +++ b/Site/App_GlobalResources/Pages.Ledgers.resx @@ -241,19 +241,6 @@ Bank Download Instructions Header above instructions for generation of the bank file type selected. - - Different banks have different means of obtaining the BGMAX format file. On SEB, you go to <strong>Payments</strong> and <strong>File communications</strong> to see a list of files to retrieve. Other banks will vary. In any case, upload them here. - - - Log on to PayPal. Go to <strong>Your Account</strong>, and under the <strong>History</strong> menu, select <strong>Download History</strong>. Select <strong>Custom Date Range</strong>, enter the range since last download (as indicated) plus some overlap, and most importantly, select <strong>Tab Delimited - All Activity</strong>. Click <strong>Download</strong>.</p><p>Some time will pass before you get a mail from PayPal saying that the file is ready for download. It will be named <em>download.txt</em>. Upload this file. - - - Log on to Payson. Go to the <strong>History</strong> tab, and click <strong>Export history</strong>. The downloaded file will be named <em>Payson_Export_[date].xls</em>. Upload this file. - - - 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>. Upload this file. - 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 Swarmops.</strong> This is usually due to missing transactions. Please upload a transaction list with a larger time span to make sure that Swarmops sees all transactions.</p><p>Swarmops's bookkeeping account is currently <strong>not in sync</strong> with that of the bank.</p> Displayed when import successful, but end balance out of sync. Assumes plural along all pasted numbers. @@ -983,8 +970,12 @@ There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard. - - As this was the first upload to this automated account, the initial balance of {0} {1:N2} going into the year {2} has been detected and set. - {0} is currency, {1} is amount, {2} is the first accounting year + + As this was the first upload to this automated account, the initial balance of <strong>{0} {1:N2}</strong> going into the year {2} has been detected and set + {1} {2:N2} is the currency and amount, like USD 2,151.00. + + + (which was accounted for with <strong>{0} {1:N2}</strong> in the presentation currency) + {0} {1:N2} is a currency and amount, which is how an initial bank balance in a foreign currency was entered into the ledgers after converting to the organization's accounting currency \ No newline at end of file diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index 86c8eea3..3d635a72 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -283,6 +283,8 @@ namespace Swarmops.Site.Pages.Ledgers [WebMethod] public static ReportedImportResults GetReportedImportResults (string guid) { + AuthenticationData authData = GetAuthenticationDataAndCulture(); + ReportedImportResults results = new ReportedImportResults(); ImportResultsCategory category = (ImportResultsCategory) GuidCache.Get (guid + "-Result"); ImportResults resultDetail = GuidCache.Get (guid + "-ResultDetails") as ImportResults; @@ -297,7 +299,26 @@ namespace Swarmops.Site.Pages.Ledgers resultDetail.TransactionsImported, resultDetail.DuplicateTransactions, resultDetail.EarliestTransaction, resultDetail.LatestTransaction); - // if (resultDetail.) + if (resultDetail.InitialBalanceCents != 0) + { + html += "

" + + String.Format(Resources.Pages.Ledgers.UploadBankFiles_ResultsInitialBalanceSet, + Currency.FromCode(resultDetail.InitialBalanceCurrencyCode).DisplayCode, + resultDetail.InitialBalanceCents/100.0); + + if (resultDetail.CurrencyCode != resultDetail.InitialBalanceCurrencyCode) + { + // nonpresentation currency + + html += + String.Format( + Resources.Pages.Ledgers.UploadBankFiles_ResultsInitialBalanceSetForeignCurrency, + Currency.FromCode(resultDetail.CurrencyCode).DisplayCode, + resultDetail.BalanceMismatchCents); + } + + html += ".

"; + } break; case ImportResultsCategory.Questionable: @@ -372,7 +393,7 @@ namespace Swarmops.Site.Pages.Ledgers ImportResults results = ProcessImportedData (externalData, (ProcessThreadArguments) args); GuidCache.Set (guid + "-ResultDetails", results); - if (results.AccountBalanceMatchesBank) + if (results.AccountBalanceMatchesBank || results.InitialBalanceCents != 0) { GuidCache.Set (guid + "-Result", ImportResultsCategory.Good); } @@ -789,11 +810,11 @@ namespace Swarmops.Site.Pages.Ledgers if (autosetInitialBalance) { - Int64 newInitialBalanceCents = result.BalanceMismatchCents - importedCentsTotal; + Int64 newInitialBalanceCents = result.BalanceMismatchCents; assetAccount.InitialBalanceCents = new Money(newInitialBalanceCents, accountCurrency); - result.InitialBalanceCents = (newInitialBalanceCents/100.0).ToString("N2"); - result.InitialBalanceCurrency = accountCurrency.DisplayCode; + result.InitialBalanceCents = newInitialBalanceCents; + result.InitialBalanceCurrencyCode = accountCurrency.Code; } } @@ -1029,8 +1050,8 @@ namespace Swarmops.Site.Pages.Ledgers public DateTime EarliestTransaction; public DateTime LatestTransaction; public int TransactionsImported; - public string InitialBalanceCents; - public string InitialBalanceCurrency; + public Int64 InitialBalanceCents; + public string InitialBalanceCurrencyCode; public ImportResults() {