Ejemplo n.º 1
0
        private void processAccount(GncAccount acct, int depth)
        {
            var balsnaps = acct.EnumSplits(false).Where(spl => spl.IsBalsnap).ToArray();

            if (!balsnaps.Any())
            {
                _report.SetValue(acct, Tr.PgLastBalsnap.ColLast, Tr.PgLastBalsnap.LastNever, "lastbalsnap_never");
            }
            else
            {
                var lastsnap  = balsnaps.OrderBy(spl => spl.Transaction.DatePosted).Last();
                var lastsplit = acct.EnumSplits(false).Last();
                if (lastsnap.Balsnap == 0 && object.ReferenceEquals(lastsplit, lastsnap) && lastsnap.AccountBalanceAfter == 0)
                {
                    _report.SetValue(acct, Tr.PgLastBalsnap.ColLast, Tr.PgLastBalsnap.LastZero, "lastbalsnap_zero");
                }
                else
                {
                    int days = (int)(DateTime.Today - lastsnap.Transaction.DatePosted).TotalDays;
                    _report.SetValue(acct, Tr.PgLastBalsnap.ColLast, Tr.PgLastBalsnap.LastNDaysAgo.Fmt(Tr.Language.GetNumberSystem(), days), makeCss(days));
                }
            }

            foreach (var acctChild in acct.EnumChildren())
            {
                processAccount(acctChild, depth + 1);
            }
        }
Ejemplo n.º 2
0
 protected static void SetReportAmount(ReportAccounts report, GncAccount acct, object colref, GncMultiAmount amount, bool isConverted, string url = null)
 {
     if (amount.Count == 0)
     {
         report.SetValue(acct, colref, "-", ReportTable.CssClassNumber(0));
     }
     else
     {
         var val = FormatCcys(amount, isConverted, whole: true);
         report.SetValue(acct, colref, url == null ? val : new A(val)
         {
             href = url
         },
                         isConverted ? ReportTable.CssClassNumber(amount.Single().Quantity) : "");
     }
 }