const string DIRECTION_D = "1";//贷方向

        #endregion

        #region 结转到下一年
        public static bool JZtoNextYear()
        {
            //bool result = false;
            //获取当前企业代码
            string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            try
            {
                //获取结转下一年的期末余额的记录ID
                DataTable dtid = EndItemProcessing.GetJZNextYearRecordId(CompanyCD);
                //登帐凭证期末余额ID
                string AccountID = string.Empty;
                //实例存放科目实体的数组
                ArrayList modelList = new ArrayList();

                if (dtid != null && dtid.Rows.Count > 0)
                {
                    foreach (DataRow rows in dtid.Rows)
                    {
                        AccountID += rows["ID"].ToString() + ",";
                    }
                    AccountID = AccountID.Remove(AccountID.Length - 1);
                    //获取科目年末余额
                    DataTable dtEndAmount = EndItemProcessing.GetJZNextYearEndAmount(AccountID);
                    //定义会计科目实体
                    AccountSubjectsModel model = null;
                    if (dtEndAmount != null && dtEndAmount.Rows.Count > 0)
                    {
                        foreach (DataRow row in dtEndAmount.Rows)
                        {
                            //实例科目实体
                            model = new AccountSubjectsModel();
                            model.SubjectsCD = row["SubjectsCD"].ToString();
                            model.CompanyCD = CompanyCD;
                            model.YInitialValue = Convert.ToDecimal(row["EndAmount"]);
                            modelList.Add(model);
                        }
                    }
                }
                //更新会计科目年初始值
                return EndItemProcessing.UpdateSubjectsYInitialValue(modelList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
       /// <summary>
       /// 更新科目期初值
       /// </summary>
       /// <param name="Model">科目实体</param>
       /// <returns>True 成功,false失败</returns>
       public static bool UpdateBeginMoney(AccountSubjectsModel Model)
       {
           StringBuilder sql = new StringBuilder();
           sql.AppendLine("Update officedba.AccountSubjects set CreateDate=@CreateDate,");
           sql.AppendLine("YInitialValue=@YInitialValue,YTotalDebit=@YTotalDebit,");
           sql.AppendLine("YTotalLenders=@YTotalLenders,BeginMoney=@BeginMoney where ID=@ID and CompanyCD=@CompanyCD");
           SqlParameter[]parms=new SqlParameter[7];
           parms[0] = SqlHelper.GetParameter("@CreateDate", Model.CreateDate);
           parms[1] = SqlHelper.GetParameter("@YInitialValue", Model.YInitialValue);
           parms[2] = SqlHelper.GetParameter("@YTotalDebit", Model.YTotalDebit);
           parms[3] = SqlHelper.GetParameter("@YTotalLenders", Model.YTotalLenders);
           parms[4] = SqlHelper.GetParameter("@BeginMoney", Model.BeginMoney);
           parms[5] = SqlHelper.GetParameter("@ID", Model.ID);
           parms[6] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD);

           SqlHelper.ExecuteTransSql(sql.ToString(), parms);
           return SqlHelper.Result.OprateCount > 0 ? true : false;
       }
 /// <summary>
 /// 新增会计科目信息 
 /// </summary>
 /// <param name="Model">科目实体</param>
 /// <returns>True 成功,false失败</returns>
 public static bool InsertAccountSubjects(AccountSubjectsModel Model)
 {
     StringBuilder sql = new StringBuilder();
     sql.AppendLine("Insert into Officedba.AccountSubjects(CompanyCD,SubjectsCD,SubjectsName, ");
     sql.AppendLine("ParentID,SubjectsType,Type,BlanceDire,CreateDate,AuciliaryCD,ForCurrencyAcc,UsedStatus)");
     sql.AppendLine("Values(@CompanyCD,@SubjectsCD,@SubjectName,");
     sql.AppendLine("@ParentID,@SubjectsType,@Type,@BlanceDire,getdate(),@AuciliaryCD,@ForCurrencyAcc,@UsedStatus)");
     SqlParameter []parms=new SqlParameter[10];
     parms[0] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD);
     parms[1] = SqlHelper.GetParameter("@SubjectsCD", Model.SubjectsCD);
     parms[2] = SqlHelper.GetParameter("@SubjectName", Model.SubjectsName);
     parms[3] = SqlHelper.GetParameter("@ParentID", Model.ParentID);
     parms[4] = SqlHelper.GetParameter("@SubjectsType", Model.SubjectsType);
     parms[5] = SqlHelper.GetParameter("@Type", Model.Type);
     parms[6] = SqlHelper.GetParameter("@BlanceDire", Model.BlanceDire);
     parms[7] = SqlHelper.GetParameter("@AuciliaryCD", Model.AuciliaryCD);
     parms[8] = SqlHelper.GetParameter("@ForCurrencyAcc", Model.ForCurrencyAcc);
     parms[9] = SqlHelper.GetParameter("@UsedStatus", Model.UsedStatus);
     SqlHelper.ExecuteTransSql(sql.ToString(), parms);
     return SqlHelper.Result.OprateCount > 0 ? true : false;
 }
       /// <summary>
       /// 修改会计科目信息
       /// </summary>
       /// <param name="Model">科目实体</param>
       /// <returns>True 成功,false失败</returns>
       public static bool UpdateAccountSubjects(AccountSubjectsModel Model)
       {
           StringBuilder sql = new StringBuilder();
           sql.AppendLine("Update  Officedba.AccountSubjects set SubjectsCD=@SubjectsCD, ");
           sql.AppendLine("SubjectsName=@SubjectsName,ParentID=@ParentID,SubjectsType=@SubjectsType,Type=@Type,BlanceDire=@BlanceDire,");
           sql.AppendLine("AuciliaryCD=@AuciliaryCD,UsedStatus=@UsedStatus,ForCurrencyAcc=@ForCurrencyAcc    where CompanyCD=@CompanyCD and ID=@ID ");
           SqlParameter[]parms=new  SqlParameter[11];
           parms[0] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD);
           parms[1] = SqlHelper.GetParameter("@SubjectsName", Model.SubjectsName);
           parms[2] = SqlHelper.GetParameter("@ParentID", Model.ParentID);
           parms[3] = SqlHelper.GetParameter("@SubjectsType", Model.SubjectsType);
           parms[4] = SqlHelper.GetParameter("@Type", Model.Type);

           parms[5] = SqlHelper.GetParameter("@BlanceDire", Model.BlanceDire);
           parms[6] = SqlHelper.GetParameter("@AuciliaryCD", Model.AuciliaryCD);
           parms[7] = SqlHelper.GetParameter("@ForCurrencyAcc", Model.ForCurrencyAcc);
           parms[8] = SqlHelper.GetParameter("@ID", Model.ID);
           parms[9] = SqlHelper.GetParameter("@UsedStatus", Model.UsedStatus);
           parms[10] = SqlHelper.GetParameter("@SubjectsCD", Model.SubjectsCD);
           SqlHelper.ExecuteTransSql(sql.ToString(),parms);
           return SqlHelper.Result.OprateCount > 0 ? true : false;
       }
Пример #5
0
       /// <summary>
       /// 修改会计科目信息
       /// </summary>
       /// <param name="Model">科目实体</param>
       /// <returns>True 成功,false失败</returns>
       public static bool UpdateAccountSubjects(AccountSubjectsModel Model)
       {
           UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
           if (Model == null) return false;
           if (Model.CompanyCD == null) Model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

           try
           {
               bool succ = false;
               string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;
               LogInfoModel logModel = InitLogInfo(Model.SubjectsCD);
               logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
               succ = AccountSubjectsDBHelper.UpdateAccountSubjects(Model);

               if (!succ)
                   logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
               else
                   logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
               LogDBHelper.InsertLog(logModel);
               return succ;
           }
           catch (Exception ex)
           {
               WriteSystemLog(userInfo, ex);
               throw ex;
           }
       }
Пример #6
0
 /// <summary>
 /// 更新科目期初值
 /// </summary>
 /// <param name="Model">科目实体</param>
 /// <returns>True 成功,false失败</returns>
 public static bool UpdateBeginMoney(AccountSubjectsModel Model)
 {
     UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
     if (Model == null) return false;
     if (Model.CompanyCD == null) Model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
     try
     {
         return AccountSubjectsDBHelper.UpdateBeginMoney(Model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }