Example #1
0
        public static QifLine LineToQif(string line, Rules rules)
        {
            var item = line.Split(new char[] { '\t' });
            /*
                0: "BOKF?RINGSDATO"
                1: "RENTEDATO"
                2: "ARKIVREFERANSE"
                3: "TYPE"
                4: "TEKST"
                5: "UT FRA KONTO"
                6: "INN P? KONTO"
                7:
             */
            string date = item[0];
            string amount = item[5] == "" ? item[6] : string.Format("-{0}", item[5]);

            string number = item[2];

            string payee = "";
            string category = "" ;
            if (item[3].ToLower().Contains("overføring"))
            {
                category = "Transfer";
                payee = "SKB Unspecified";
                //Console.Out.WriteLine("TRANSFER: {0}", line);
                //throw new NotImplementedException(line);
            }
            else{
                category = rules.FindCategory(item[4]);
                payee = rules.FindPayee(item[4]);
            }
            string message = item[4];

            date = date.Replace("\"", "");
            amount = amount.Replace("\"", "");
            payee = payee.Replace("\"", "");
            number = number.Replace("\"", ""); number = number.Replace("*", "0");
            category = category.Replace("\"", "");
            message = message.Replace("\"", "");

            QifLine qifLine = new QifLine(date, amount, payee, number, category, message);

            return qifLine;
        }
Example #2
0
        public void GenerateEntry(QifLine qifLine)
        {
            /*
            D2011-02-28
            T-590,00
            PVarekjop
            N17017734769
            LUnknown
            M26.02 NARVESEN HOLMLIA SENT OSLO
            ^
            */
            ut.WriteLine("D{0}", qifLine.Date);
            ut.WriteLine("T{0}", qifLine.Amount);
            ut.WriteLine("P{0}", qifLine.Payee);
            ut.WriteLine("N{0}", qifLine.Number);
            ut.WriteLine("L{0}", qifLine.Category);
            ut.WriteLine("M{0}", qifLine.Message);
            Section();

            ut.Flush();
        }