Exemplo n.º 1
0
        public Dictionary <string, string> Calc(Dictionary <string, string> template)
        {
            SystemProfileService systemProfile = SystemProfileService.GetInstance(mContext);
            var curYear   = systemProfile.GetInt(SystemProfileCategory.Account, SystemProfileKey.CurrentYear);
            var curPeriod = systemProfile.GetInt(SystemProfileCategory.Account, SystemProfileKey.CurrentPeriod);

            AccountBalanceService abService = AccountBalanceService.GetInstance(mContext);

            m_lstYear   = abService.QueryOccurs(curYear, 1, curYear, 12);
            m_lstOccurs = abService.QueryOccurs(curYear, curPeriod, curYear, curPeriod);
            m_lstAso    = DataManager.GetInstance(mContext).Query <AccountSubject>(null).OrderBy(a => a.no).ToList();

            Dictionary <string, string> result = new Dictionary <string, string>();
            List <string> sumKeys = new List <string>();

            foreach (KeyValuePair <string, string> kv in template)
            {
                if (Regex.IsMatch(kv.Value, "(L)") && !Regex.IsMatch(kv.Value, "(SL)"))
                {
                    sumKeys.Add(kv.Key);
                    continue;
                }
                result.Add(kv.Key, Calc(kv.Value));
            }

            sumKeys.Sort();
            foreach (string key in sumKeys)
            {
                result.Add(key, SampleCalculator.sumLine(template[key], key, result));
            }

            return(result);
        }
Exemplo n.º 2
0
        public Dictionary <string, string> Calc(IDictionary <string, object> filter, IDictionary <string, string> template)
        {
            var beginYear   = int.Parse(filter["beginYear"].ToString());
            var beginPeriod = int.Parse(filter["beginPeriod"].ToString());
            var endYear     = int.Parse(filter["endYear"].ToString());
            var endPeriod   = int.Parse(filter["endPeriod"].ToString());

            AccountBalanceService abService = AccountBalanceService.GetInstance(mContext);
            var prev = CommonUtils.CalcPrevPeriod(new PeridStrunct {
                Year = beginYear, Period = beginPeriod
            });

            m_lstBegin  = abService.QuerySettled(prev.Year, prev.Period);
            m_lstOccurs = abService.QueryOccurs(beginYear, beginPeriod, endYear, endPeriod);
            m_lstAso    = DataManager.GetInstance(mContext).Query <AccountSubject>(null).OrderBy(a => a.no).ToList();

            Dictionary <string, string> result = new Dictionary <string, string>();
            List <string> sumKeys = new List <string>();

            foreach (KeyValuePair <string, string> kv in template)
            {
                if (Regex.IsMatch(kv.Value, "(L)"))
                {
                    sumKeys.Add(kv.Key);
                    continue;
                }
                var rnt = Calc(kv.Value);
                result.Add(kv.Key, rnt);
                logger.Debug("{0} {1} {2}", kv.Key, rnt, kv.Value);
            }

            sumKeys.Sort();
            foreach (string key in sumKeys)
            {
                result.Add(key, SampleCalculator.sumLine(template[key], key, result));
            }

            return(result);
        }