diff --git a/Database/Database-Financials.cs b/Database/Database-Financials.cs index bf567ce4..01357896 100644 --- a/Database/Database-Financials.cs +++ b/Database/Database-Financials.cs @@ -292,9 +292,8 @@ namespace Activizr.Database return GetFinancialAccountRows(new int[] {financialAccountId}, startDateTime, endDateTime); } - - public BasicFinancialAccountRow[] GetFinancialAccountRows (int[] financialAccountIds, DateTime startDateTime, - DateTime endDateTime) + public BasicFinancialAccountRow[] GetFinancialAccountRows(int[] financialAccountIds, DateTime startDateTime, + DateTime endDateTime) { var result = new List(); @@ -323,6 +322,38 @@ namespace Activizr.Database } + public BasicFinancialAccountRow[] GetLastFinancialAccountRows (int financialAccountId, int rowCount) + { + return GetLastFinancialAccountRows(new int[] {financialAccountId}, rowCount); + } + + public BasicFinancialAccountRow[] GetLastFinancialAccountRows (int[] financialAccountIds, int rowCount) + { + var result = new List(); + + using (DbConnection connection = GetMySqlDbConnection()) + { + connection.Open(); + + DbCommand command = + GetDbCommand( + "select FinancialTransactionRows.FinancialAccountId,FinancialTransactionRows.FinancialTransactionId,FinancialTransactions.DateTime,FinancialTransactions.Comment,FinancialTransactionRows.AmountCents,FinancialTransactionRows.CreatedDateTime,FinancialTransactionRows.CreatedByPersonId FROM FinancialTransactions,FinancialTransactionRows WHERE FinancialTransactionRows.Deleted=0 AND FinancialTransactions.FinancialTransactionId=FinancialTransactionRows.FinancialTransactionId AND FinancialTransactionRows.FinancialAccountId IN (" + + JoinIds(financialAccountIds) + ") ORDER BY DateTime DESC,FinancialTransactions.FinancialTransactionId,FinancialTransactionRows.CreatedDateTime LIMIT " + rowCount.ToString() + ";", + connection); + + using (DbDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + result.Add(ReadFinancialAccountRowFromDataReader(reader)); + } + + return result.ToArray(); + } + } + } + + public BasicFinancialTransactionRow[] GetFinancialTransactionRows(int financialTransactionId) { var result = new List(); diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index 3d375467..f2171c8d 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -41,6 +41,12 @@ namespace Activizr.Logic.Financial return PirateDb.GetDatabase().GetFinancialAccountBalanceDeltaCents(Identity, start, end); } + public FinancialAccountRows GetLastRows(int rowCount) + { + BasicFinancialAccountRow[] basicRows = PirateDb.GetDatabase().GetLastFinancialAccountRows(Identity, rowCount); + return FinancialAccountRows.FromArray(basicRows); + } + public FinancialAccountRows GetRows(DateTime start, DateTime end) { BasicFinancialAccountRow[] basicRows = PirateDb.GetDatabase().GetFinancialAccountRows(Identity, start, end); diff --git a/Logic/Pirates/Person.cs b/Logic/Pirates/Person.cs index 0a4b28cc..1a8301c4 100644 --- a/Logic/Pirates/Person.cs +++ b/Logic/Pirates/Person.cs @@ -1023,7 +1023,7 @@ namespace Activizr.Logic.Pirates // For now, return true if Anna, Janne, or Rick. Bad hack, bad, really bad. - if (this.Identity == 2) + if (this.Identity == 1) { return true; } diff --git a/Site5/App_GlobalResources/Pages.Global.resx b/Site5/App_GlobalResources/Pages.Global.resx index f30b0ea2..e15b9b51 100644 --- a/Site5/App_GlobalResources/Pages.Global.resx +++ b/Site5/App_GlobalResources/Pages.Global.resx @@ -157,6 +157,18 @@ Go there... Link after describing something. + + Upload File + Displayed on "Submit" button next to file upload controls. + + + Upload File To Activizr + Used as header above upload sections. + + + Please select a file to upload. + Error message. Displayed when the used has clicked "Upload" without selecting a file to upload. + Actions List of shortcuts to likely actions diff --git a/Site5/App_GlobalResources/Pages.Ledgers.resx b/Site5/App_GlobalResources/Pages.Ledgers.resx index d6787b3a..0731b877 100644 --- a/Site5/App_GlobalResources/Pages.Ledgers.resx +++ b/Site5/App_GlobalResources/Pages.Ledgers.resx @@ -117,14 +117,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - You should include all records from at least <strong>{0:yyyy-MMM-dd}.</strong> + + </p><p>(The most recent data in Activizr is from {0:yyyy-MMM-dd}. You should download bank data from at least <strong>{1:yyyy-MMM-dd}.</strong>) + Displayed to help user determine scope of bank download + + + </p><p>(Paypal will tell you the time of the last transaction download. Download all transactions from that point in time, adding some three days of overlap.) + Displayed instead of date of last transaction in the case of Paypal. Bank Download Instructions 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>. Only translate to languages where SEB is active. @@ -140,8 +145,15 @@ Select Bookkeeping Account Select prompt for the financial account in the organization's bookkeeping. + + Select File Type And Account For Upload + - Select Bank File Type For Upload + Select Bank File Type Header above several bank logos, prompting a selection of bank. + + Upload Bank File + Displayed as header above download instructions / upload form + \ No newline at end of file diff --git a/Site5/App_GlobalResources/Pages.Security.resx b/Site5/App_GlobalResources/Pages.Security.resx index 9ed44a51..70cbd2dc 100644 --- a/Site5/App_GlobalResources/Pages.Security.resx +++ b/Site5/App_GlobalResources/Pages.Security.resx @@ -127,6 +127,6 @@ Access Denied - <p>The Activizr security framework has denied you access to the page you were trying to go to. This usually means that its functions were above the access levels granted to you for the currently selected organization ({0}). This has not been logged nor reported anywhere.</p><p>There are several reasons why this may have happened:</p> + <p>The Activizr security framework has denied you access to the page you were trying to go to. This usually means that its functions were above the access levels granted to you for the currently selected organization (<em>{0}</em>). This has not been logged nor reported anywhere.</p><p>There are several reasons why this may have happened:</p> \ No newline at end of file diff --git a/Site5/Images/Icons/iconshock-cross-96px.png b/Site5/Images/Icons/iconshock-cross-96px.png new file mode 100644 index 00000000..40e7f9a1 Binary files /dev/null and b/Site5/Images/Icons/iconshock-cross-96px.png differ diff --git a/Site5/Images/Icons/iconshock-disconnect-96px.png b/Site5/Images/Icons/iconshock-disconnect-96px.png index ee94b3b6..da64b54d 100644 Binary files a/Site5/Images/Icons/iconshock-disconnect-96px.png and b/Site5/Images/Icons/iconshock-disconnect-96px.png differ diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx index 5f5cf716..44a51439 100644 --- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx +++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx @@ -116,8 +116,8 @@ div.BankUploadInstructionsImage -

-

+

+

@@ -153,6 +153,7 @@ div.BankUploadInstructionsImage
+
diff --git a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index 23c48ebf..c2fde486 100644 --- a/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site5/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -31,7 +31,12 @@ namespace Activizr.Site.Pages.Ledgers this.LabelUploadBankFilesInfo.Text = Resources.Pages.Ledgers.UploadBankFiles_Info; this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Todo_Placeholder; - this.LabelSelectBankUploadFilter.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectBankFileType; + this.LabelSelectBankAndAccount.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectBankAndAccount; + this.LabelSelectFileType.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectBankFileType; + this.LabelSelectAccount.Text = Resources.Pages.Ledgers.UploadBankFiles_SelectAccount; + this.LabelUploadH2Header.Text = Resources.Pages.Ledgers.UploadBankFiles_UploadBankFile; + this.LabelUploadH3Header.Text = Resources.Pages.Global.Global_UploadFileToActivizr; + this.Upload.Text = Resources.Pages.Global.Global_UploadFile; if (!IsPostBack) { @@ -68,7 +73,7 @@ namespace Activizr.Site.Pages.Ledgers this.LiteralDownloadInstructions.Text = this.LiteralDownloadInstructionsModal.Text = - Resources.Pages.Ledgers.UploadBankFiles_DownloadInstructionsSebAccountFile; + Resources.Pages.Ledgers.UploadBankFiles_DownloadInstructions_SebAccountFile; } @@ -91,7 +96,7 @@ namespace Activizr.Site.Pages.Ledgers { this.LiteralSelectAccountDivStyle.Text = @"style=""opacity:1;display:inline"""; - if (this.DropAccounts.SelectedIndex > -2) + if (this.DropAccounts.SelectedIndex > 0) { ScriptManager.RegisterClientScriptBlock(this.PanelFileTypeAccount, this.PanelFileTypeAccount.GetType(), "FadeDownload2", "$(\"#DivInstructions\").fadeTo('slow',1.0);", true); @@ -101,8 +106,17 @@ namespace Activizr.Site.Pages.Ledgers "$(function () { $(\"a[rel*=leanModal]\").leanModal();});", true); - + FinancialAccount account = FinancialAccount.FromIdentity(Int32.Parse(this.DropAccounts.SelectedValue)); + FinancialAccountRows rows = account.GetLastRows(1); + DateTime lastTransactionDateTime = new DateTime(1801, 1, 1); + + if (rows != null && rows.Count > 0) + { + lastTransactionDateTime = rows[0].RowDateTime; + } + + this.LiteralLastAccountRecord.Text = String.Format(Resources.Pages.Ledgers.UploadBankFiles_DownloadDataSince, lastTransactionDateTime, lastTransactionDateTime.AddDays(-5)); } } @@ -115,6 +129,7 @@ namespace Activizr.Site.Pages.Ledgers UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[fileInputID]); if (file.ContentLength > 0) { + // TODO: PROCESS // file.SaveAs("c:\\temp\\" + file.GetName()); RadProgressContext progress = RadProgressContext.Current; @@ -155,13 +170,13 @@ namespace Activizr.Site.Pages.Ledgers { // If no file was uploaded, re-show the instructions div - this.LabelNoFileUploaded.Text = "Please upload a file LOC"; - this.LiteralDivInstructionsStyle.Text = "style='display:inline'"; + this.LabelNoFileUploaded.Text = Resources.Pages.Global.Global_Upload_ErrorSelectFile; + this.LiteralDivInstructionsStyle.Text = @"style='display:inline'"; } else { this.LabelNoFileUploaded.Text = string.Empty; - this.LiteralDivInstructionsStyle.Text = "style='display:none'"; + this.LiteralDivInstructionsStyle.Text = @"style='display:none'"; } } }