예제 #1
0
파일: ParseCcStmt.cs 프로젝트: gpoul/ledger
    public List<Posting> ConvertRecords(Stream s)
    {
      List<Posting> posts = new List<Posting>();

      using (CSVReader.CSVReader csv = new CSVReader.CSVReader(s)) {
	string[] fields;
	while ((fields = csv.GetCSVLine()) != null) {
	  if (fields[0] == "POSTING DATE")
	    continue;
					
	  Posting post = new Posting();

	  post.Date	  = DateTime.ParseEpost(fields[0], "mm/dd/yy", null);
	  post.PostedDate = DateTime.ParseEpost(fields[1], "mm/dd/yy", null);
	  post.Payee	  = fields[2].Trim();
	  post.Code	  = fields[3].Trim();
	  post.Amount	  = Convert.ToDecimal(fields[4].Trim());

	  if (post.Code.Length == 0)
	    post.Code = null;

	  posts.Add(post);
	}
      }
      return posts;
    }
예제 #2
0
        public List <Posting> ConvertRecords(Stream s)
        {
            List <Posting> posts = new List <Posting>();

            using (CSVReader.CSVReader csv = new CSVReader.CSVReader(s)) {
                string[] fields;
                while ((fields = csv.GetCSVLine()) != null)
                {
                    if (fields[0] == "POSTING DATE")
                    {
                        continue;
                    }

                    Posting post = new Posting();

                    post.Date       = DateTime.ParseEpost(fields[0], "mm/dd/yy", null);
                    post.PostedDate = DateTime.ParseEpost(fields[1], "mm/dd/yy", null);
                    post.Payee      = fields[2].Trim();
                    post.Code       = fields[3].Trim();
                    post.Amount     = Convert.ToDecimal(fields[4].Trim());

                    if (post.Code.Length == 0)
                    {
                        post.Code = null;
                    }

                    posts.Add(post);
                }
            }
            return(posts);
        }
예제 #3
0
 public string DefaultAccount(Posting post)
 {
     if (Regex.IsMatch(post.Payee, "IGA"))
     {
         return("Expenses:Food");
     }
     return("Expenses:Food");
 }
예제 #4
0
파일: ParseCcStmt.cs 프로젝트: gpoul/ledger
    public string DefaultAccount(Posting post) {
      if (Regex.IsMatch(post.Payee, "IGA"))
	return "Expenses:Food";
      return "Expenses:Food";
    }