diff --git a/Logic/Financial/ExternalBankData.cs b/Logic/Financial/ExternalBankData.cs index b2af63d5..b5e33409 100644 --- a/Logic/Financial/ExternalBankData.cs +++ b/Logic/Financial/ExternalBankData.cs @@ -46,7 +46,32 @@ namespace Swarmops.Logic.Financial string organizationCurrencyCode = organization.Currency.Code; - int crlfIndex = data.IndexOfAny (new[] {'\n', '\r'}); + + // Replace any strings initially to force the bank data into readability (per profile) + + string[] replacements = Profile.InitialReplacements.Split('|'); + + for (int loop = 0; loop < replacements.Length/2; loop++) + { + data = data.Replace(replacements[loop*2], replacements[loop*2 + 1]); + } + + int crlfIndex; + + for (int loop = 0; loop < Profile.IgnoreInitialLines && !String.IsNullOrEmpty(data); loop++) + { + crlfIndex = data.IndexOfAny(new[] { '\n', '\r' }); + if (crlfIndex > 0) + { + data = data.Substring(crlfIndex).Trim(); + } + else + { + data = string.Empty; + } + } + + crlfIndex = data.IndexOfAny (new[] {'\n', '\r'}); string fieldKeyLine = data.Substring (0, crlfIndex); @@ -61,7 +86,7 @@ namespace Swarmops.Logic.Financial { for (int index = 0; index < dataKeyFields.Length; index++) { - if (dataKeyFields[index].Trim() == Profile.FieldNames[fieldName]) + if (StripQuotes(dataKeyFields[index]).Trim() == Profile.FieldNames[fieldName]) { fieldNameLookup[fieldName] = index; break; diff --git a/Logic/Financial/ExternalBankDataProfile.cs b/Logic/Financial/ExternalBankDataProfile.cs index c4039383..dae3f697 100644 --- a/Logic/Financial/ExternalBankDataProfile.cs +++ b/Logic/Financial/ExternalBankDataProfile.cs @@ -45,12 +45,19 @@ namespace Swarmops.Logic.Financial get { return 2; } } + public static int DEPostbankId + { + get { return 3; } + } + public string Name { get; set; } public Country Country { get; set; } public string Culture { get; set; } public string Currency { get; set; } public string BankDataAccountReader { get; set; } public string BankDataPaymentsReader { get; set; } + public int IgnoreInitialLines { get; set; } + public string InitialReplacements { get; set; } public Dictionary FieldNames { get; private set; } @@ -109,6 +116,29 @@ namespace Swarmops.Logic.Financial return result; } + if (externalBankDataProfileId == DEPostbankId) + { + result.Name = "DE Postbank"; + result.Country = Country.FromCode("DE"); + result.Culture = "de-DE"; + result.IgnoreInitialLines = 8; + result.InitialReplacements = ";|\t| €| (€)|"; + + result.FieldNames[ExternalBankDataFieldName.Date] = "Buchungstag"; + result.FieldNames[ExternalBankDataFieldName.Description] = "Buchungsdetails"; + result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Betrag"; + result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo"; + + result.LatestTransactionLocation = LatestTransactionLocation.Top; + result.FeeSignage = FeeSignage.Unknown; // no inline fees + result.Precision = ExternalBankDateTimePrecision.Day; + + result.BankDataAccountReader = StockBankDataReaders.TabSeparatedValuesAccountReader; + result.BankDataPaymentsReader = null; // No aggregated payments with Paypal + + return result; + } + throw new ArgumentException ("Unrecognized profile Id"); } } diff --git a/Logic/Financial/FinancialAccount.cs b/Logic/Financial/FinancialAccount.cs index a7d12fd4..5719ebea 100644 --- a/Logic/Financial/FinancialAccount.cs +++ b/Logic/Financial/FinancialAccount.cs @@ -212,6 +212,12 @@ namespace Swarmops.Logic.Financial return ExternalBankDataProfile.FromIdentity (ExternalBankDataProfile.SESebId); } + if (OrganizationId == 8 && PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && + FinancialAccountId == 150) + { + return ExternalBankDataProfile.FromIdentity(ExternalBankDataProfile.DEPostbankId); + } + return null; } } diff --git a/Logic/Financial/StockBankDataReaders.cs b/Logic/Financial/StockBankDataReaders.cs index 8112f9d2..906c63fa 100644 --- a/Logic/Financial/StockBankDataReaders.cs +++ b/Logic/Financial/StockBankDataReaders.cs @@ -8,6 +8,11 @@ get { return "TabSeparatedValuesReader"; } } + public static string SemicolonSeparatedValuesAccountReader + { + get { return "SemicolonSeparatedValuesReader"; } + } + public static string SEPaymentsBankgiroReader { get { return "SEPaymentsBankgiroReader"; } diff --git a/Site/Controls/v5/Base/FileUpload.ascx b/Site/Controls/v5/Base/FileUpload.ascx index dc387ba0..c6bccec8 100644 --- a/Site/Controls/v5/Base/FileUpload.ascx +++ b/Site/Controls/v5/Base/FileUpload.ascx @@ -18,18 +18,11 @@ $('#<%=this.ClientID %>_ButtonUploadHidden').fileupload({ url: '/Automation/UploadFileHandler.ashx?Guid=<%= GuidString %>&Filter=<%=Filter %>', dataType: 'json', - done: function(e, data) { + done: function (e, data) { + var pdfConversionNeeded = false; $.each(data.result, function(index, file) { if (file.error == null || file.error.length < 1) { $('#<%=this.ClientID %>_DivUploadCount').append(imageUploadSuccess); - - <% if (!String.IsNullOrEmpty(this.ClientUploadCompleteCallback)) - { %> - - <%= this.ClientUploadCompleteCallback %>("<%= GuidString%>", "<%= Cookie%>"); - - <% } %> - } else { $('#<%=this.ClientID %>_DivUploadCount').append(imageUploadFail); // Assume ERR_NOT_IMAGE alertify.error('File "' + file.name + '" could not be uploaded. Is it really an image?'); @@ -37,7 +30,20 @@ }); $('#<%=this.ClientID %>_DivProgressUpload').progressbar({ value: 100 }); - $('#<%=this.ClientID %>_DivProgressUpload').fadeOut('400', function () { $('#<%=this.ClientID %>_DivUploadCount').fadeIn(); }); + if (pdfConversionNeeded) { + $('#<%=this.ClientID %>_DivProgressPdfConversion').progressbar({ value: 1 }); + $('#<%=this.ClientID %>_DivMainControlArea').fadeOut('400', function() { $('#<%=this.ClientID %>_DivPdfConverting').fadeIn(); }); + } else { + + <% if (!String.IsNullOrEmpty(this.ClientUploadCompleteCallback)) + { %> + + <%= this.ClientUploadCompleteCallback %>("<%= GuidString%>", "<%= Cookie%>"); + + <% } %> + + $('#<%=this.ClientID %>_DivProgressUpload').fadeOut('400', function() { $('#<%=this.ClientID %>_DivUploadCount').fadeIn(); }); + } }, progressall: function(e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); @@ -49,6 +55,7 @@ add: function(e, data) { $('#<%=this.ClientID %>_DivUploadCount').css('display', 'none'); $('#<%=this.ClientID %>_DivProgressUpload').progressbar({ value: 0 }); // reset in case of previous uploads on this page + $('#<%=this.ClientID %>_DivProgressPdfConvert').progressbar({ value: 0 }); $('#<%=this.ClientID %>_DivProgressUpload').fadeIn(); data.submit(); @@ -66,12 +73,51 @@ $('#<%=this.ClientID %>_ButtonUploadHidden').click(); }); - $('#<%=this.ClientID %>_DivProgressUpload').progressbar({ value: 0, max: 100 }); + $('#<%=this.ClientID %>_DivProgressPdfConvert').progressbar({ value: 0, max: 100 }); }); + function <%=this.ClientID%>_repingPdfProgress() { + + var jsonData = {}; + jsonData.guid = "Pdf-<%=GuidString%>"; + + SwarmopsJS.ajaxCall( + "/Automation/Json-ByGuid.aspx/GetProgress2", + jsonData, + function(result) { + }, + function(error) { + } + ); + + SwarmopsJS.ajaxCall() + setTimeout(function() { <%=this.ClientID%>_repingPdfProgress(); }, 500); + } + -
/>
+
+
+
+ /> +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ +
diff --git a/Site/Images/Icons/iconshock-pdf-128px.png b/Site/Images/Icons/iconshock-pdf-128px.png new file mode 100644 index 00000000..45f36119 Binary files /dev/null and b/Site/Images/Icons/iconshock-pdf-128px.png differ diff --git a/Site/Pages/v5/Financial/FileExpenseClaim.aspx b/Site/Pages/v5/Financial/FileExpenseClaim.aspx index d820e9ee..f7824152 100644 --- a/Site/Pages/v5/Financial/FileExpenseClaim.aspx +++ b/Site/Pages/v5/Financial/FileExpenseClaim.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Financial.FileExpenseClaim" Codebehind="FileExpenseClaim.aspx.cs" %> +<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Pages.v5.Financial.FileExpenseClaim" CodeFile="FileExpenseClaim.aspx.cs" Codebehind="FileExpenseClaim.aspx.cs" %> <%@ Register src="~/Controls/v5/Base/FileUpload.ascx" tagname="FileUpload" tagprefix="Swarmops5" %> <%@ Register TagPrefix="Swarmops5" TagName="ComboBudgets" Src="~/Controls/v5/Financial/ComboBudgets.ascx" %> <%@ Register TagPrefix="Swarmops5" TagName="Currency" Src="~/Controls/v5/Financial/CurrencyTextBox.ascx" %> diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs index 593bd276..86c23e88 100644 --- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs +++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs @@ -267,8 +267,11 @@ namespace Swarmops.Site.Pages.Ledgers return "(Instruct Stock-SE-SEB)"; case 2: return "(Instruct Stock-Global-Paypal)"; + case 150: + return "(Instruct Stock-DE-Postbank)"; default: throw new NotImplementedException(); + } } diff --git a/Site/Pages/v5/Security/ChangeOrganizations.aspx b/Site/Pages/v5/Security/ChangeOrganizations.aspx index 98f0c4bb..2665a43b 100644 --- a/Site/Pages/v5/Security/ChangeOrganizations.aspx +++ b/Site/Pages/v5/Security/ChangeOrganizations.aspx @@ -47,7 +47,7 @@ background-position: left; padding-left: 2px; margin-left: 4px; - margin-right: 8px; + margin-right: 2px; background-repeat: no-repeat; width: 70px; height: 48px; diff --git a/Site/Pages/v5/Security/ChangeOrganizations.aspx.cs b/Site/Pages/v5/Security/ChangeOrganizations.aspx.cs index bab10dae..d9e61058 100644 --- a/Site/Pages/v5/Security/ChangeOrganizations.aspx.cs +++ b/Site/Pages/v5/Security/ChangeOrganizations.aspx.cs @@ -51,7 +51,17 @@ namespace Swarmops.Frontend.Pages.v5.Security Document logoLandscape = organization.LogoLandscape; - newOrganizationParameters.LogoImage = logoLandscape.Image.GetBase64(70, 48); + try + { + if (logoLandscape != null) + { + newOrganizationParameters.LogoImage = logoLandscape.Image.GetBase64(64, 36); + } + } + catch (Exception) + { + newOrganizationParameters.LogoImage = "/Images/Flags/txl-64px.png"; + } newOrganizationParameters.OrganizationId = membership.OrganizationId; newOrganizationParameters.OrganizationName = membership.Organization.Name; diff --git a/Site/Site.csproj b/Site/Site.csproj index 4f945d54..a6bad5dc 100644 --- a/Site/Site.csproj +++ b/Site/Site.csproj @@ -730,6 +730,7 @@ +