Ejemplo n.º 1
0
        public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName)
        {
            numberOfSupoerPortRecords = 0;

            logger.Write("    Nordea format");

            int hdlobl = 0;
            int udbakt = 0;
            int kntopd = 0;
            int hdlakt = 0;
            int rntobl = 0;
            int rntknt = 0;
            int gbrtrn = 0;
            int behold = 0;

            if (lines.Length > 0)
            {
                for (int k = 0; k < lines.Length; k++)
                {
                    string[] fields = lines[k].Split((char)31);
                    if (debugLevel)
                    {
                        logger.WriteFields(fields);
                    }

                    // skip previous records
                    if (nordeaOldRecords.previousRecord(lines[k]))
                    {
                        logger.Write("      Denne record er allerede bogført");
                        continue;
                    }

                    // write this to the file of previous records
                    nordeaOldRecords.addRecord(lines[k]);

                    if (lines[k].IndexOf("UDBAKT") == 0)
                    {
                        udbakt++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Nordea UDBAKT record " + udbakt + " has too few fields";
                            logger.Write("      Udbytte aktier record too few fields");
                        }
                        else
                        {
                            impRecord.setIdCode(fields[4]);
                            impRecord.setSettlementDate(fields[11]);
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setPrice(fields[17]);
                            // yeield tax should be decucted - hence negativ and the dash infront of the field
                            impRecord.setYieldTax("-" + fields[24]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 10);

                            impRecord.setCurrenciesRate(fields[56]);

                            // take last 14 digits
                            // impRecord.setDepotNumber(fields[34], false, 14);
                            string depot = nordeaDepot.getDepot(impRecord.getAccountNumber());
                            if (depot.Equals(string.Empty))
                            {
                                success = false;
                                string acc = fields[30];
                                acc        = acc.Trim();
                                acc        = acc.TrimStart('0');
                                emailBody += "Try to get Nordea Depot code for account " + acc + " but was not found in the Nordea depot file.\n";
                            }
                            impRecord.setDepotNumber("0000000000" + depot, false, 10);

                            impRecord.setTransactionType("U");
                            impRecord.setNota('N');
                            impRecord.blankAmount();
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeUdbytteAktier(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("KNTOPD") == 0)
                    {
                        kntopd++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Nordea KNTOPD record " + kntopd + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);
                            impRecord.setCurrenciesRate(fields[23]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 10);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setTransactionType("I");
                            impRecord.setNota('N');
                            impRecord.setAmount(fields[17]);
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeIndsaetHaev(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("HDLAKT") == 0)
                    {
                        hdlakt++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Nordea HDLAKT record " + hdlakt + " has too few fields";
                            logger.Write("      Handel med aktier record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[3]);
                            impRecord.setIdCode(fields[4]);
                            if (fields[17].Length > 0 && fields[17][0] == '-')
                            {
                                impRecord.setTransactionType("S"); // Salg
                            }
                            else
                            {
                                impRecord.setTransactionType("K"); // Køb
                            }

                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setAmount(fields[17]);
                            impRecord.setExchangeRate(fields[18]);

                            CultureInfo cultureInfo  = new CultureInfo("en-US");
                            Decimal     currencyRate = Convert.ToDecimal(fields[56], cultureInfo);
                            Decimal     kurtage      = Convert.ToDecimal(fields[21], cultureInfo);
                            Decimal     cost         = Convert.ToDecimal(fields[20], cultureInfo);
                            impRecord.setKurtage("-" + Math.Round(cost + kurtage / currencyRate * 100, 2).ToString());

                            //impRecord.setKurtage("-" + fields[21]);
                            impRecord.setCurrenciesRate(fields[56]);
                            impRecord.setYieldTax("-" + fields[24]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 10);
                            // take last 14 digits

                            string depot = nordeaDepot.getDepot(impRecord.getAccountNumber());
                            if (depot.Equals(string.Empty))
                            {
                                success = false;
                                string acc = fields[30];
                                acc        = acc.Trim();
                                acc        = acc.TrimStart('0');
                                emailBody += "Try to get Nordea Depot code for account " + acc + " but was not found in the Nordea depot file.\n";
                            }
                            impRecord.setDepotNumber("0000000000" + depot, false, 10);

                            impRecord.setNota('N');
                            impRecord.setCounterPart("NO"); // Nordea


                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeKoebSalgAktier(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("GBRTRN") == 0)
                    {
                        gbrtrn++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Nordea GBRTRN record " + gbrtrn + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);
                            impRecord.setCurrenciesRate(fields[23]);
                            // take last 10 digits
                            impRecord.setAccountNumber(fields[30], false, 10);

                            /* depot not used for gebyr
                             * string depot = nordeaDepot.getDepot(impRecord.getAccountNumber());
                             * if (depot.Equals(string.Empty))
                             * {
                             *  success = false;
                             *  string acc = fields[30];
                             *  acc = acc.Trim();
                             *  acc = acc.TrimStart('0');
                             *  emailBody += "Try to get Nordea Depot code for account " + acc + " but was not found in the Nordea depot file.\n";
                             * }
                             * impRecord.setDepotNumber("0000000000" + depot, false, 10);*/

                            impRecord.setTransactionType("I");
                            impRecord.setNota('N');
                            impRecord.setAmount(fields[17]);
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeIndsaetHaev(fileName);
                        }
                    }
                    else if (lines[k].Length > 12 && lines[k][10] == 31 && lines[k][11] == 31)
                    {
                        behold++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 6)
                        {
                            emailBody += Environment.NewLine + "Nordea BEHOLD record " + behold + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields (" + fields.Length + ")");
                        }
                        else
                        {
                            // TODO
                        }
                    }
                    else if (lines[k].Length > 12 && lines[k][10] == 31)
                    {
                        kntopd++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 9)
                        {
                            emailBody += Environment.NewLine + "Nordea KNTOPD record " + kntopd + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields (" + fields.Length + ")");
                        }
                        else
                        {
                            // TODO
                        }
                    }
                    else
                    {
                        // success = false; It is ok with unknown danske bank formats
                        logger.Write("      Ukendt record format, " + lines[k].Split((char)31)[0]);
                    }
                }
                if (hdlobl > 0)
                {
                    logger.Write("      Handel med obligationer og pantebreve : " + hdlobl);
                }
                if (udbakt > 0)
                {
                    logger.Write("      Udbytte aktier : " + udbakt);
                }
                if (hdlakt > 0)
                {
                    logger.Write("      Handel med aktier : " + hdlakt);
                }
                if (rntobl > 0)
                {
                    logger.Write("      Kupon rente for obligationer og pantebreve : " + rntobl);
                }
                if (rntknt > 0)
                {
                    logger.Write("      Rente konto : " + rntknt);
                }
                if (gbrtrn > 0)
                {
                    logger.Write("      Gebyr konto : " + gbrtrn);
                }
                if (kntopd > 0)
                {
                    logger.Write("      Konto opdatering : " + kntopd);
                }
                if (behold > 0)
                {
                    logger.Write("      Konto beholdning : " + behold);
                }
            }
            else
            {
                if (lines.Length == 2 && lines[1].IndexOf("TAIL") == 0)
                {
                    logger.Write("      Filen indeholder ingen rcords");
                }
                else
                {
                    success = false;
                    logger.Write("      Ukendt fil format");
                }
            }

            return(numberOfSupoerPortRecords);
        }
Ejemplo n.º 2
0
        public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName, string folder)
        {
            numberOfSupoerPortRecords = 0;

            logger.Write("    Jyske Bank format");

            string counterPart = "JB";

            if (folder.ToLower().Contains("sydbank"))
            {
                counterPart = "SB";
            }

            if (lines.Length > 1)
            {
                int ub      = 0;
                int kr      = 0;
                int ks      = 0;
                int ksAnuls = 0;

                for (int k = 1; k < lines.Length; k++)
                {
                    string[] fields = lines[k].Split(';');

                    if (fields[0].CompareTo("KS") == 0)
                    {
                        if (fields[5].CompareTo("95") == 0)
                        {
                            annuls.Add(fields[6]);
                        }
                    }
                }

                for (int k = 1; k < lines.Length; k++)
                {
                    string[] fields = lines[k].Split(';');
                    if (debugLevel)
                    {
                        logger.WriteFields(fields);
                    }

                    if (fields[0].CompareTo("UB") == 0)
                    {
                        ImpRecord impRecord = new ImpRecord(logger);

                        impRecord.setTransactionDate(fields[10]);  // // not fields[6] as it has to be the same as settlementdate
                        // use the dictionary to get the isin code
                        impRecord.setIdCode(fondCode.getIsin(fields[3]));
                        impRecord.setSettlementDate(fields[10]);
                        // impRecord.setTransactionNumber(fields[4]); use SuperPorts
                        // The file does not contain the original amount so we have to calculate it from the currency rate and the settled amount, in danish number format
                        CultureInfo cultureInfo      = new CultureInfo("da-DK");
                        Decimal     currencyRate     = Convert.ToDecimal(fields[11], cultureInfo);
                        Decimal     settlementAmount = Convert.ToDecimal(fields[14], cultureInfo);
                        impRecord.setPrice(Math.Round(settlementAmount / currencyRate * 100, 2).ToString());

                        impRecord.setCurrenciesRate(fields[11]);
                        // yeield tax should be decucted - hence negativ and the dash infront of the field
                        Decimal tax = Convert.ToDecimal(fields[15], cultureInfo);
                        impRecord.setYieldTax("-" + Math.Round(tax / currencyRate * 100, 2).ToString());
                        // take last 14 digits
                        impRecord.setAccountNumber(fields[2], false, 14);
                        // take last 14 digits

                        impRecord.setDepotNumber(fields[1], false, 14);
                        impRecord.setNota('N');
                        impRecord.blankAmount();
                        impRecord.blankKurtage();

                        Decimal cost = Convert.ToDecimal(fields[16], cultureInfo);
                        impRecord.setCost("-" + Math.Round(cost / currencyRate * 100, 2).ToString());

                        impRecord.setStatus('N');

                        impRecord.setCurrenciesCross(fields[8] + "/" + fields[9]);

                        if (fields[7] == "A")
                        {
                            ub++;
                            impRecord.setTransactionType("U");
                            numberOfSupoerPortRecords++;
                            impRecord.writeUdbytteAktier(fileName);
                        }
                        else if (fields[7] == "K")
                        {
                            kr++;
                            impRecord.setTransactionType("KR");
                            numberOfSupoerPortRecords++;
                            impRecord.writeRenteKuponer(fileName);
                        }
                    }

                    if (fields[0].CompareTo("KS") == 0)
                    {
                        ImpRecord impRecord = new ImpRecord(logger);

                        impRecord.setTransactionDate(fields[11]);

                        impRecord.setTransactionType(fields[8]);
                        impRecord.setSettlementDate(fields[12]);
                        // impRecord.setTransactionNumber(fields[4]); use SuperPorts
                        impRecord.setAmount(fields[14]);
                        impRecord.setExchangeRate(fields[15]);

                        CultureInfo cultureInfo  = new CultureInfo("da-DK");
                        Decimal     currencyRate = Convert.ToDecimal(fields[13], cultureInfo);
                        // Remove negative kurtage, as all kurtage is negative
                        Decimal kurtage = Convert.ToDecimal(fields[17].Replace('-', ' '), cultureInfo);
                        impRecord.setKurtage("-" + Math.Round(kurtage / currencyRate * 100, 2).ToString());
                        impRecord.setCurrenciesRate(fields[13]);
                        // take last 14 digits
                        impRecord.setAccountNumber(fields[2], false, 14);
                        // take last 14 digits
                        impRecord.setDepotNumber(fields[1], false, 14);
                        impRecord.setNota('N');
                        impRecord.setCounterPart(counterPart); // Jydske bank

                        impRecord.setStatus('N');

                        impRecord.setCurrenciesCross(fields[9], fields[10]);

                        // use the dictionary to get the isin code
                        string idCode = fondCode.getIsin(fields[3]);
                        if (idCode.Equals(string.Empty))
                        {
                            success    = false;
                            emailBody += "Try to get Isin code " + fields[3] + " but was not found in the fondcode file.\n";
                        }
                        else
                        {
                            impRecord.setIdCode(idCode);

                            // check for anuls
                            if (isAnul(fields[4]))
                            {
                                ksAnuls++;
                            }
                            else
                            {
                                ks++;
                                numberOfSupoerPortRecords++;
                                impRecord.writeKoebSalgAktier(fileName);
                            }
                        }
                    }
                }

                if (ub > 0)
                {
                    logger.Write("      Udbytte : " + ub);
                }
                if (kr > 0)
                {
                    logger.Write("      Kupon : " + kr);
                }
                if (ks > 0)
                {
                    logger.Write("      Køb Salg : " + ks);
                }
                if (ksAnuls > 0)
                {
                    logger.Write("      Køb Salg, annuleret : " + ksAnuls);
                }
            }

            return(numberOfSupoerPortRecords);
        }
Ejemplo n.º 3
0
        public int Process(ref string emailBody, ref bool debugLevel, ref bool success, string fileName)
        {
            numberOfSupoerPortRecords = 0;

            logger.Write("    Danske Bank format");

            int hdlobl = 0;
            int udbakt = 0;
            int kntopd = 0;
            int hdlakt = 0;
            int rntobl = 0;
            int rntknt = 0;
            int gbrtrn = 0;

            if (lines.Length > 2)
            {
                for (int k = 1; k < lines.Length - 1; k++)
                {
                    string[] fields = lines[k].Split((char)31);
                    if (debugLevel)
                    {
                        logger.WriteFields(fields);
                    }

                    if (lines[k].IndexOf("HDLOBL") == 0)
                    {
                        hdlobl++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 70)
                        {
                            emailBody += Environment.NewLine + "Danske bank KS record " + hdlobl + " has too few fields";
                            logger.Write("      Handel med obligationer og pantebreve record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setIdCode(fields[4]);
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setAmount(fields[17]);
                            impRecord.setExchangeRate(fields[18]);
                            CultureInfo cultureInfo  = new CultureInfo("en-US");
                            Decimal     currencyRate = Convert.ToDecimal(fields[23], cultureInfo);
                            Decimal     kurtage      = Convert.ToDecimal(fields[21], cultureInfo);
                            Decimal     cost         = Convert.ToDecimal(fields[22], cultureInfo);
                            impRecord.setKurtage("-" + Math.Round(cost + kurtage / currencyRate * 100, 2).ToString());
                            //impRecord.setKurtage("-" + fields[21]);
                            impRecord.setCurrenciesCross(fields[55], fields[53]);
                            impRecord.setCurrenciesRate(fields[23]);
                            impRecord.setInterest(fields[24]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            //impRecord.setPrice(fields[31]);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);

                            if (fields[17].Length > 0 && fields[17][0] == '-')
                            {
                                impRecord.setTransactionType("S"); // Salg
                            }
                            else
                            {
                                impRecord.setTransactionType("K"); // Køb
                            }
                            impRecord.setStatus('N');
                            impRecord.setNota('N');
                            impRecord.setCounterPart("DB"); // Danske bank

                            impRecord.writeKoebSalgObligationer(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("UDBAKT") == 0)
                    {
                        udbakt++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Danske Bank UDBAKT record " + udbakt + " has too few fields";
                            logger.Write("      Udbytte aktier record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setIdCode(fields[4]);
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);
                            impRecord.setCurrenciesRate(fields[23]);
                            // yeield tax should be decucted - hence negativ and the dash infront of the field
                            impRecord.setYieldTax("-" + fields[24]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setTransactionType("U");
                            impRecord.setNota('N');
                            impRecord.blankAmount();
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeUdbytteAktier(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("KNTOPD") == 0)
                    {
                        kntopd++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Danske Bank KNTOPD record " + kntopd + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);
                            impRecord.setCurrenciesRate(fields[23]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setTransactionType("I");
                            impRecord.setNota('N');
                            impRecord.setAmount(fields[17]);
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeIndsaetHaev(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("HDLAKT") == 0)
                    {
                        hdlakt++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 72)
                        {
                            emailBody += Environment.NewLine + "Danske Bank HDLAKT record " + hdlakt + " has too few fields";
                            logger.Write("      Handel med aktier record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[3]);
                            impRecord.setIdCode(fields[4]);
                            if (fields[17].Length > 0 && fields[17][0] == '-')
                            {
                                impRecord.setTransactionType("S"); // Salg
                            }
                            else
                            {
                                impRecord.setTransactionType("K"); // Køb
                            }

                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setAmount(fields[17]);
                            impRecord.setExchangeRate(fields[18]);

                            CultureInfo cultureInfo  = new CultureInfo("en-US");
                            Decimal     currencyRate = Convert.ToDecimal(fields[23], cultureInfo);
                            Decimal     kurtage      = Convert.ToDecimal(fields[21], cultureInfo);
                            Decimal     cost         = Convert.ToDecimal(fields[22], cultureInfo);
                            impRecord.setKurtage("-" + Math.Round(cost + kurtage / currencyRate * 100, 2).ToString());

                            //impRecord.setKurtage("-" + fields[21]);
                            impRecord.setCurrenciesRate(fields[23]);
                            impRecord.setYieldTax(fields[24]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setNota('N');
                            impRecord.setCounterPart("DB"); // Danske bank


                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeKoebSalgAktier(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("RNTOBL") == 0)
                    {
                        rntobl++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Danske Bank RNTOBL record " + rntobl + " has too few fields";
                            logger.Write("      Kupon rente for obligationer og pantebreve record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setIdCode(fields[4]);
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);

                            impRecord.setExchangeRate(fields[17]);
                            impRecord.setKurtage("-" + fields[21]);
                            impRecord.setAmount(fields[32]);
                            impRecord.setCurrenciesRate(fields[23]);
                            impRecord.setYieldTax(fields[24]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setTransactionType("KR");
                            impRecord.setNota('N');

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeRenteKuponer(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("RNTKNT") == 0)
                    {
                        rntknt++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Danske Bank RNTKNT record " + rntknt + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);
                            impRecord.setCurrenciesRate(fields[23]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setTransactionType("I");
                            impRecord.setNota('N');
                            impRecord.setAmount(fields[17]);
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeIndsaetHaev(fileName);
                        }
                    }
                    else if (lines[k].IndexOf("GBRTRN") == 0)
                    {
                        gbrtrn++;
                        ImpRecord impRecord = new ImpRecord(logger);

                        if (fields.Length < 58)
                        {
                            emailBody += Environment.NewLine + "Danske Bank GBRTRN record " + gbrtrn + " has too few fields";
                            logger.Write("      Konto opdatering record too few fields");
                        }
                        else
                        {
                            impRecord.setTransactionDate(fields[11]); // not fields[3] as it has to be the same as settlementdate
                            impRecord.setSettlementDate(fields[11]);
                            // impRecord.setTransactionNumber(splitTransactioNumber(fields[16])); use SuperPorts
                            impRecord.setPrice(fields[17]);
                            impRecord.setCurrenciesRate(fields[23]);
                            // take last 14 digits
                            impRecord.setAccountNumber(fields[30], false, 14);
                            // take last 14 digits
                            impRecord.setDepotNumber(fields[34], false, 14);
                            impRecord.setTransactionType("I");
                            impRecord.setNota('N');
                            impRecord.setAmount(fields[17]);
                            impRecord.blankKurtage();

                            impRecord.setStatus('N');

                            impRecord.setCurrenciesCross(fields[55], fields[53]);

                            numberOfSupoerPortRecords++;
                            impRecord.writeIndsaetHaev(fileName);
                        }
                    }
                    else
                    {
                        // success = false; It is ok with unknown danske bank formats
                        logger.Write("      Ukendt record format, " + lines[k].Split((char)31)[0]);
                    }
                }
                if (hdlobl > 0)
                {
                    logger.Write("      Handel med obligationer og pantebreve : " + hdlobl);
                }
                if (udbakt > 0)
                {
                    logger.Write("      Udbytte aktier : " + udbakt);
                }
                if (hdlakt > 0)
                {
                    logger.Write("      Handel med aktier : " + hdlakt);
                }
                if (rntobl > 0)
                {
                    logger.Write("      Kupon rente for obligationer og pantebreve : " + rntobl);
                }
                if (rntknt > 0)
                {
                    logger.Write("      Rente konto : " + rntknt);
                }
                if (gbrtrn > 0)
                {
                    logger.Write("      Ren-gebyrte konto : " + gbrtrn);
                }
                if (kntopd > 0)
                {
                    logger.Write("      Konto opdatering : " + kntopd);
                }
            }
            else
            {
                if (lines.Length == 2 && lines[1].IndexOf("TAIL") == 0)
                {
                    logger.Write("      Filen indeholder ingen rcords");
                }
                else
                {
                    success = false;
                    logger.Write("      Ukendt fil format");
                }
            }

            return(numberOfSupoerPortRecords);
        }