Ejemplo n.º 1
0
        public override void CopyTo(object dst)
        {
            EntryEx en = dst as EntryEx;

            if (en != null)
            {
                base.CopyTo(en);
                en.JMoney = JMoney;
                en.DMoney = DMoney;
                en.Bal    = Bal;
            }
        }
Ejemplo n.º 2
0
        public EntryExList GetEntryExList(double bal, string fristDigest, string filterExpress, string sort, bool CloseYearDigest, DateTime startDate, bool allowDailyTotal)
        {
            EntryExList entries = new EntryExList();
            double      d       = bal;
            double      dy1     = 0;
            double      dm1     = 0;
            double      dDaily1 = 0;
            double      dy2     = 0;
            double      dm2     = 0;
            double      dDaily2 = 0;
            int         entryID = 0;

            DataRow[] drs = GetDataRows(filterExpress, sort);

            EntryEx entryStart = new EntryEx();

            entryStart.ID = entryID;
            entryID++;
            entryStart.Digest = fristDigest;// "上期余额";
            entryStart.Side   = 0;
            entryStart.Bal    = d;
            entryStart.Date   = Core.General.FromDateTime(startDate);
            entries.Add(entryStart);
            int y     = 0;
            int m     = 0;
            int daily = 0;

            if (drs != null)
            {
                foreach (DataRow dr in drs)
                {
                    DateTime dt    = Core.General.FromString(dr["RecordDate"].ToString());
                    EntryEx  entry = new EntryEx();
                    #region 写每日小计,每月合计,本期累计
                    if (daily != 0 && daily != dt.Day && allowDailyTotal)
                    {
                        entry    = new EntryEx();
                        entry.ID = entryID;
                        entryID++;
                        entry.Digest = "本日小计";
                        entry.JMoney = dDaily1;
                        entry.DMoney = dDaily2;
                        entry.Bal    = d;
                        entry.Side   = 0;
                        entries.Add(entry);
                        dDaily1 = 0;
                        dDaily2 = 0;
                    }
                    if (m != 0 && m != dt.Month)
                    {
                        entry    = new EntryEx();
                        entry.ID = entryID;
                        entryID++;
                        entry.Digest = "本月合计";
                        entry.JMoney = dm1;
                        entry.DMoney = dm2;
                        entry.Bal    = d;
                        entry.Side   = 0;
                        entries.Add(entry);
                        dm1 = 0;
                        dm2 = 0;
                        if (!(y != 0 && y != dt.Year))
                        {
                            //同时写"本年累计",注意dy1,dy2不要归零
                            entry    = new EntryEx();
                            entry.ID = entryID;
                            entryID++;
                            entry.Digest = "本年累计";
                            entry.JMoney = dy1;
                            entry.DMoney = dy2;
                            entry.Bal    = d;
                            entry.Side   = 0;
                            entries.Add(entry);
                        }
                    }
                    if (y != 0 && y != dt.Year)
                    {
                        entry    = new EntryEx();
                        entry.ID = entryID;
                        entryID++;
                        entry.Digest = "本年累计";
                        entry.JMoney = dy1;
                        entry.DMoney = dy2;
                        entry.Bal    = d;
                        entry.Side   = 0;
                        entries.Add(entry);
                        dy1 = 0;
                        dy2 = 0;
                    }
                    #endregion
                    entry    = new EntryEx();
                    entry.ID = entryID;
                    entryID++;
                    entry.Date       = dr["RecordDate"].ToString();
                    entry.Digest     = dr["digest"].ToString();
                    entry.VchType    = dr["VchType"].ToString();
                    entry.VchNumber  = dr["VchNumber"].ToString();
                    entry.ChequeType = dr["ChequeType"].ToString();
                    entry.Cheque     = dr["ChequeId"].ToString();
                    entry.Money      = (double)(dr["money"]);
                    entry.Side       = (int)dr["side"];
                    if (entry.Side == 1)
                    {
                        d       += entry.Money;
                        dDaily1 += entry.Money;
                        dm1     += entry.Money;
                        dy1     += entry.Money;
                    }
                    else
                    {
                        d       -= entry.Money;
                        dDaily2 += entry.Money;
                        dm2     += entry.Money;
                        dy2     += entry.Money;
                    }
                    entry.Bal = d;
                    entries.Add(entry);
                    y     = dt.Year;
                    m     = dt.Month;
                    daily = dt.Day;
                }
            }
            #region 写每日小计,每月合计,本年累计

            if (allowDailyTotal)
            {
                entryStart    = new EntryEx();
                entryStart.ID = entryID;
                entryID++;
                entryStart.Digest = "本日小计";
                entryStart.JMoney = dDaily1;
                entryStart.DMoney = dDaily2;
                entryStart.Bal    = d;
                entryStart.Side   = 0;
                entries.Add(entryStart);
                dDaily1 = 0;
                dDaily2 = 0;
            }
            entryStart    = new EntryEx();
            entryStart.ID = entryID;
            entryID++;
            entryStart.Digest = "本月合计";
            entryStart.JMoney = dm1;
            entryStart.DMoney = dm2;
            entryStart.Bal    = d;
            entryStart.Side   = 0;
            entries.Add(entryStart);
            dm1 = 0;
            dm2 = 0;

            entryStart    = new EntryEx();
            entryStart.ID = entryID;
            entryID++;
            entryStart.Digest = "本年累计";
            entryStart.JMoney = dy1;
            entryStart.DMoney = dy2;
            entryStart.Bal    = d;
            entryStart.Side   = 0;
            entries.Add(entryStart);

            if (CloseYearDigest)
            {
                entryStart    = new EntryEx();
                entryStart.ID = entryID;
                entryID++;
                entryStart.Digest = "结转下年";
                entryStart.JMoney = 0;
                entryStart.DMoney = 0;
                entryStart.Bal    = d;
                entryStart.Side   = 0;
                entries.Add(entryStart);
            }
            dy1 = 0;
            dy2 = 0;
            #endregion

            return(entries);
        }