Exemple #1
0
        public List<PayrollItemFormEntity> GetPayrollItemFormEntityByFilter(PayrollItemSearchTerm filter)
        {
            List<PayrollItemFormEntity> items = new List<PayrollItemFormEntity>();
            foreach (PayrollItemFormEntity item in payrollItems.Values)
            {
                if (filter.Match(item))
                {
                    items.Add(item);
                }
            }

            return items;
        }
Exemple #2
0
        public double Sum(string[] flags)
        {
            double res = 0;

            // 组织检索条件。
            PayrollItemSearchTerm term = new PayrollItemSearchTerm();
            string flagstring = "";
            string grpstr = "";
            foreach (string f in flags)
            {
                if (PayrollItemDef.Instance.IsGroupId(f))
                {
                    if (!grpstr.Equals(""))
                    {
                        grpstr += ",";
                    }
                    grpstr += f;
                }
                else
                {
                    if (!flagstring.Equals(""))
                    {
                        flagstring += ",";
                    }
                    flagstring += f;
                }
            }
            term.MultiCalcFlag = flagstring;
            term.MultiGroup = grpstr;

            // 取得符合条件Item。
            List<PayrollItem> items = dataPool.GetPayrollItemByFilter(term);

            // 计算合计。
            foreach (PayrollItem item in items)
            {
                SyntaxTreeNode tree = GetTree(item.Fomula);
                if (null != tree)
                {
                    res += Convert.ToDouble(tree.Value);
                }
            }

            return res;
        }