Ejemplo n.º 1
0
        public virtual void WriteXact(Xact xact)
        {
            if (xact.Pos != null)
            {
                Out.AppendFormat("\"{0}\" {1} ", xact.Pos.PathName, xact.Pos.BegLine);
            }
            else
            {
                Out.Append("\"\" -1 ");
            }

            DateTime when = xact.GetDate().FromLocalToUtc();
            int      date = when.ToPosixTime();

            Out.AppendFormat("({0} {1} 0) ", date / 65536, date % 65536);

            if (!String.IsNullOrEmpty(xact.Code))
            {
                Out.AppendFormat("\"{0}\" ", xact.Code);
            }
            else
            {
                Out.Append("nil ");
            }

            if (String.IsNullOrEmpty(xact.Payee))
            {
                Out.Append("nil");
            }
            else
            {
                Out.AppendFormat("\"{0}\"", xact.Payee);
            }

            Out.AppendLine();
        }
Ejemplo n.º 2
0
        public override void Handle(Post post)
        {
            if (!post.HasXData || !post.XData.Displayed)
            {
                if (LastXact == null)
                {
                    Out.Append("((");
                    WriteXact(post.Xact);
                }
                else if (post.Xact != LastXact)
                {
                    Out.Append(")");
                    Out.AppendLine();
                    Out.Append(" (");
                    WriteXact(post.Xact);
                }
                else
                {
                    Out.AppendLine();
                }

                if (post.Pos != null)
                {
                    Out.AppendFormat("  ({0} ", post.Pos.BegLine);
                }
                else
                {
                    Out.Append("  (-1 ");
                }

                Out.AppendFormat("\"{0}\" \"{1}\"", post.ReportedAccount.FullName, post.Amount);

                switch (post.State)
                {
                case ItemStateEnum.Uncleared:
                    Out.Append(" nil");
                    break;

                case ItemStateEnum.Cleared:
                    Out.Append(" t");
                    break;

                case ItemStateEnum.Pending:
                    Out.Append(" pending");
                    break;
                }

                if (post.Cost != null)
                {
                    Out.AppendFormat(" \"{0}\"", post.Cost);
                }
                if (!String.IsNullOrEmpty(post.Note))
                {
                    Out.AppendFormat(" \"{0}\"", EscapeString(post.Note));
                }
                Out.Append(")");

                LastXact = post.Xact;

                post.XData.Displayed = true;
            }
        }