Exemple #1
0
        public 受托人合同 Get受托人合同(IRepository rep, int 费用实体类型, string 受托人编号)
        {
            string key = 费用实体类型.ToString() + "," + 受托人编号;

            if (!s_wtrhts.ContainsKey(key))
            {
                IList <受托人合同> list = (rep as Feng.NH.INHibernateRepository).List <受托人合同>(NHibernate.Criterion.DetachedCriteria.For <受托人合同>()
                                                                                         .Add(NHibernate.Criterion.Expression.Eq("业务类型编号", 费用实体类型))
                                                                                         .Add(NHibernate.Criterion.Expression.Eq("受托人编号", 受托人编号))
                                                                                         .Add(NHibernate.Criterion.Expression.Le("有效期始", System.DateTime.Today))
                                                                                         .Add(NHibernate.Criterion.Expression.Ge("有效期止", System.DateTime.Today))
                                                                                         .AddOrder(NHibernate.Criterion.Order.Desc("签约时间"))
                                                                                         .SetMaxResults(1));

                if (list.Count > 0)
                {
                    受托人合同 strht = list[0];
                    rep.Initialize(strht.合同费用项, strht);
                    s_strhts[key] = strht;
                }
                else
                {
                    s_strhts[key] = null;
                }
            }
            return(s_strhts[key]);
        }
        public static void 批量生成费用付款(IRepository rep, int 费用实体类型, 普通票 票, IEnumerable 箱s, string 费用项编号, 收付标志?收付标志, IList <业务费用理论值> llzs, bool service)
        {
            if (!收付标志.HasValue || 收付标志.Value == Hd.Model.收付标志.付)
            {
                // 生成付款费用
                付款合同 fkht = HdDataBuffer.Instance.Get付款合同(rep, 费用实体类型);
                if (fkht != null)
                {
                    foreach (付款合同费用项 htfyx in fkht.合同费用项)
                    {
                        // 如果指定费用项,则只生成此费用项下的费用
                        if (!string.IsNullOrEmpty(费用项编号) &&
                            htfyx.费用项编号 != 费用项编号)
                        {
                            continue;
                        }

                        // 不是服务运行时(即界面上点按钮),付款合同费用项.是否生成实际费用 = false 不生产费用
                        if (!service && !htfyx.是否生成实际费用)
                        {
                            continue;
                        }

                        批量生成费用(rep, 票, 箱s, Hd.Model.收付标志.付, htfyx, llzs, !string.IsNullOrEmpty(费用项编号));
                    }
                }
                if (费用实体类型 == 11)
                {
                    bool?cybz = ConvertHelper.ToBoolean(EntityScript.GetPropertyValue(票, "承运标志"));
                    if (cybz.HasValue && cybz.Value)
                    {
                        // 受托人合同
                        string str = ConvertHelper.ToString(EntityScript.GetPropertyValue(票, "承运人编号"));
                        if (!string.IsNullOrEmpty(str))
                        {
                            // 生成付款费用
                            受托人合同 strht = HdDataBuffer.Instance.Get受托人合同(rep, 费用实体类型, str);
                            if (strht != null)
                            {
                                foreach (受托人合同费用项 htfyx in strht.合同费用项)
                                {
                                    // 如果指定费用项,则只生成此费用项下的费用
                                    if (!string.IsNullOrEmpty(费用项编号) &&
                                        htfyx.费用项编号 != 费用项编号)
                                    {
                                        continue;
                                    }

                                    批量生成费用(rep, 票, 箱s, Hd.Model.收付标志.付, htfyx, llzs, !string.IsNullOrEmpty(费用项编号));
                                }
                            }
                        }
                    }
                }
            }
        }