Esempio n. 1
0
 public string GetEndYear([FromUri] BaseListModel param)
 {
     if (param.orgid == 0)
     {
         return(DCHelper.ErrorMessage("组织id不能为空!"));
     }
     if (string.IsNullOrEmpty(param.orgCode))
     {
         return(DCHelper.ErrorMessage("组织Code不能为空!"));
     }
     if (string.IsNullOrEmpty(param.Year))
     {
         return(DCHelper.ErrorMessage("年份信息不能为空!"));
     }
     try
     {
         YsAccountMstModel ysAccountMst = new YsAccountMstModel();
         ysAccountMst = this.YsAccountMstService.GetEndAccounts(param.orgid, param.orgCode, param.Year);
         if (ysAccountMst.YsAccounts != null && ysAccountMst.YsAccounts.Count > 0)
         {
             IList <YsAccountModel> ysAccounts = new List <YsAccountModel>();
             foreach (var acc in ysAccountMst.YsAccounts)
             {
                 if (acc.SUBJECTCODE.Length == 3)
                 {
                     YsAccountModel ys = new YsAccountModel();
                     ysAccounts.Add(this.BudgetMstService.GetCompleteYsAccount(ysAccountMst.YsAccounts, acc.SUBJECTCODE, ys));
                 }
                 else
                 {
                     if (acc.SUBJECTCODE == "4BNHJSR" || acc.SUBJECTCODE == "5BNHJZC" || acc.SUBJECTCODE.StartsWith("5QM"))
                     {
                         ysAccounts.Add(acc);
                     }
                     else
                     {
                         continue;
                     }
                 }
             }
             ysAccountMst.YsAccounts = ysAccounts;
         }
         var data = new
         {
             Status = ResponseStatus.Success,
             Msg    = "获取成功!",
             Data   = ysAccountMst
         };
         return(DataConverterHelper.SerializeObject(data));
     }
     catch (Exception ex)
     {
         return(DCHelper.ErrorMessage(ex.Message));
     }
 }
Esempio n. 2
0
 public IList <YsAccountModel> GetYsAccountsChilds(YsAccountModel ysAccount, IList <YsAccountModel> ysAccounts)
 {
     if (ysAccount.Childrens != null && ysAccount.Childrens.Count > 0)
     {
         foreach (var child in ysAccount.Childrens)
         {
             if (!string.IsNullOrEmpty(child.SUBJECTCODE))
             {
                 ysAccounts.Add(child);
                 GetYsAccountsChilds(child, ysAccounts);
             }
         }
     }
     return(ysAccounts);
 }
Esempio n. 3
0
        /// <summary>
        /// 根据组织获取该组织预算科目对应的初始预决算集合
        /// </summary>
        /// <param name="orgCode">组织Code</param>
        /// <param name="orgId">组织id</param>
        /// <param name="year">年份</param>
        /// <returns></returns>
        public List <YsAccountModel> GetYsAccountsBySubject(string orgCode, long orgId, string year)
        {
            List <YsAccountModel>       ysAccounts = new List <YsAccountModel>();
            Dictionary <string, object> dic        = new Dictionary <string, object>();

            //先获取预算所有的科目集合
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <long> .NotEq("PhId", (long)0));
            IList <BudgetAccountsModel> allAccounts = new List <BudgetAccountsModel>();

            allAccounts = this.BudgetAccountsRule.Find(dic);
            if (allAccounts == null || allAccounts.Count <= 0)
            {
                throw new Exception("预算科目数据为空!");
            }
            dic.Clear();
            new CreateCriteria(dic)
            .Add(ORMRestrictions <string> .LLike("DefStr1", orgCode))
            .Add(ORMRestrictions <string> .Eq("Dylx", "02"));
            IList <CorrespondenceSettingsModel> allAccountsByOrg = new List <CorrespondenceSettingsModel>();

            allAccountsByOrg = this.CorrespondenceSettingsRule.Find(dic);
            if (allAccountsByOrg == null || allAccountsByOrg.Count <= 0)
            {
                throw new Exception("该组织及下级组织对应的预算科目数据为空!");
            }
            allAccountsByOrg = allAccountsByOrg.ToList().FindAll(t => (t.Dydm.StartsWith("4") || t.Dydm.StartsWith("5")));
            if (allAccountsByOrg != null && allAccountsByOrg.Count > 0)
            {
                foreach (var acc in allAccountsByOrg)
                {
                    YsAccountModel accountModel = new YsAccountModel();
                    accountModel.SUBJECTCODE = acc.Dydm;
                    accountModel.SUBJECTNAME = allAccounts.ToList().Find(t => t.KMDM == acc.Dydm) == null ? "" : allAccounts.ToList().Find(t => t.KMDM == acc.Dydm).KMMC;
                    accountModel.PHIDSUBJECT = allAccounts.ToList().Find(t => t.KMDM == acc.Dydm) == null ? 0 : allAccounts.ToList().Find(t => t.KMDM == acc.Dydm).PhId;
                    accountModel.ORGID       = orgId;
                    accountModel.ORGCODE     = orgCode;
                    accountModel.UYEAR       = year;
                    if (ysAccounts.FindAll(t => t.SUBJECTCODE == acc.Dydm).Count == 0)
                    {
                        ysAccounts.Add(accountModel);
                    }
                }

                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "4BNHJSR", SUBJECTNAME = "本年合计收入", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5BNHJZC", SUBJECTNAME = "本年合计支出", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM1", SUBJECTNAME = "本年结余", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM2", SUBJECTNAME = "加:上年结余", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM3", SUBJECTNAME = "加:本年收回投资", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM4", SUBJECTNAME = "减:本年投资", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM5", SUBJECTNAME = "减:本年提取后备金", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts.Add(new YsAccountModel {
                    SUBJECTCODE = "5QM6", SUBJECTNAME = "期末滚存结余", ORGID = orgId, ORGCODE = orgCode, UYEAR = year
                });
                ysAccounts = ysAccounts.OrderBy(t => t.SUBJECTCODE).ToList();
            }
            return(ysAccounts);
        }