Esempio n. 1
0
        /// <summary>
        /// 为主表插入数据
        /// </summary>
        /// <param name="sellOrderModel"></param>
        /// <param name="tran"></param>
        private static void InsertSellOrder(FeesModel sellOrderModel, TransactionManager tran,out int IntID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into officedba.Fees(");
            strSql.Append("CompanyCD,FeesNo ,FeesNum,FeesType,InvoiceType,CreateDate,ContactUnits,ContactType,AcceWay,SubjectsNo,TotalPrice,Executor,DeptID,ConfirmStatus,Confirmor,IsAccount ,Accountor ,SourceNo,AccountsStatus,CurrencyType,CurrencyRate,Note,ProjectID)");
            strSql.Append(" values (");
            strSql.Append("@CompanyCD,@FeesNo ,@FeesNum,@FeesType,@InvoiceType,@CreateDate,@ContactUnits,@ContactType,@AcceWay,@SubjectsNo,@TotalPrice,@Executor,@DeptID,@ConfirmStatus,@Confirmor,@IsAccount ,@Accountor ,@SourceNo,@AccountsStatus,@CurrencyType,@CurrencyRate,@Note,@ProjectID) ");
            strSql.Append(" set @IntID= @@IDENTITY");

            //SqlParameter[] param = null;
            //ArrayList lcmd = new ArrayList();
            #region 参数
            //lcmd.Add(SqlHelper.GetParameterFromString("@CompanyCD", sellOrderModel.CompanyCD));
            //lcmd.Add(SqlHelper.GetParameterFromString("@FeesNo ", sellOrderModel.FeesNo));
            //lcmd.Add(SqlHelper.GetParameterFromString("@FeesNum", sellOrderModel.FeesNum));
            //lcmd.Add(SqlHelper.GetParameterFromString("@FeesType", sellOrderModel.FeesType));
            //lcmd.Add(SqlHelper.GetParameterFromString("@InvoiceType", sellOrderModel.InvoiceType));
            //lcmd.Add(SqlHelper.GetParameterFromString("@CreateDate", sellOrderModel.CreateDate.ToString()));
            //lcmd.Add(SqlHelper.GetParameterFromString("@ContactUnits", sellOrderModel.ContactUnits));
            //lcmd.Add(SqlHelper.GetParameterFromString("@ContactType", sellOrderModel.ContactType));
            //lcmd.Add(SqlHelper.GetParameterFromString("@AcceWay", sellOrderModel.AcceWay));
            //lcmd.Add(SqlHelper.GetParameterFromString("@SubjectsNo", sellOrderModel.SubjectsNo));
            //lcmd.Add(SqlHelper.GetParameterFromString("@TotalPrice", sellOrderModel.TotalPrice.ToString()));
            //lcmd.Add(SqlHelper.GetParameterFromString("@Executor", sellOrderModel.Executor));
            //lcmd.Add(SqlHelper.GetParameterFromString("@DeptID", sellOrderModel.DeptID));
            //lcmd.Add(SqlHelper.GetParameterFromString("@ConfirmStatus", sellOrderModel.ConfirmStatus));
            //lcmd.Add(SqlHelper.GetParameterFromString("@Confirmor", sellOrderModel.Confirmor));
            //lcmd.Add(SqlHelper.GetParameterFromString("@ConfirmDate", sellOrderModel.ConfirmDate.ToString()));
            //lcmd.Add(SqlHelper.GetParameterFromString("@IsAccount", sellOrderModel.IsAccount));
            //lcmd.Add(SqlHelper.GetParameterFromString("@Accountor", sellOrderModel.Accountor));
            //lcmd.Add(SqlHelper.GetParameterFromString("@AccountDate", sellOrderModel.AccountDate.ToString()));
            //lcmd.Add(SqlHelper.GetParameterFromString("@SourceNo", sellOrderModel.SourceNo));
            //lcmd.Add(SqlHelper.GetParameterFromString("@AccountsStatus", sellOrderModel.AccountsStatus));
            //lcmd.Add(SqlHelper.GetParameterFromString("@CurrencyType", sellOrderModel.CurrencyType));
            //lcmd.Add(SqlHelper.GetParameterFromString("@CurrencyRate", sellOrderModel.CurrencyRate.ToString()));
            //lcmd.Add(SqlHelper.GetParameterFromString("@Note", sellOrderModel.Note));
            //lcmd.Add(SqlHelper.GetParameterFromString("@IntID", sellOrderModel.ID));
            #endregion
            SqlParameter[] parms = new SqlParameter[24];
            parms[0] = SqlHelper.GetParameter("@CompanyCD", sellOrderModel.CompanyCD);
            parms[1] = SqlHelper.GetParameter("@FeesNo", sellOrderModel.FeesNo);
            parms[2] = SqlHelper.GetParameter("@FeesNum", sellOrderModel.FeesNum);
            parms[3] = SqlHelper.GetParameter("@FeesType", sellOrderModel.FeesType);
            parms[4] = SqlHelper.GetParameter("@InvoiceType", sellOrderModel.InvoiceType);
            parms[5] = SqlHelper.GetParameter("@CreateDate", sellOrderModel.CreateDate);
            parms[6] = SqlHelper.GetParameter("@ContactUnits", sellOrderModel.ContactUnits);
            parms[7] = SqlHelper.GetParameter("@ContactType", sellOrderModel.ContactType);
            parms[8] = SqlHelper.GetParameter("@AcceWay", sellOrderModel.AcceWay);
            parms[9] = SqlHelper.GetParameter("@SubjectsNo", sellOrderModel.SubjectsNo);
            parms[10] = SqlHelper.GetParameter("@TotalPrice", sellOrderModel.TotalPrice);
            parms[11] = SqlHelper.GetParameter("@Executor", sellOrderModel.Executor);
            parms[12] = SqlHelper.GetParameter("@DeptID", sellOrderModel.DeptID);
            parms[13] = SqlHelper.GetParameter("@ConfirmStatus", sellOrderModel.ConfirmStatus);
            parms[14] = SqlHelper.GetParameter("@Confirmor", sellOrderModel.Confirmor);
            parms[15] = SqlHelper.GetParameter("@IsAccount", sellOrderModel.IsAccount);
            parms[16] = SqlHelper.GetParameter("@Accountor", sellOrderModel.Accountor);
            parms[17] = SqlHelper.GetParameter("@SourceNo", sellOrderModel.SourceNo);
            parms[18] = SqlHelper.GetParameter("@AccountsStatus", sellOrderModel.AccountsStatus);
            parms[19] = SqlHelper.GetParameter("@CurrencyType", sellOrderModel.CurrencyType);
            parms[20] = SqlHelper.GetParameter("@CurrencyRate", sellOrderModel.CurrencyRate);
            parms[21] = SqlHelper.GetParameter("@Note", sellOrderModel.Note);
            parms[22] = SqlHelper.GetParameter("@ProjectID", sellOrderModel.ProjectID);
            parms[23] = SqlHelper.GetOutputParameter("@IntID", SqlDbType.Int);
           
            SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), parms);

            IntID = Convert.ToInt32(parms[23].Value);
        }
Esempio n. 2
0
        public static DataTable ExportFeesBySearch(string CompanyCD, FeesModel FeesM, string DateBegin, string DateEnd, string PriceB, string PriceE)
        {
            try
            {
                #region 查询SQL拼写
                StringBuilder searchSql = new StringBuilder();
                searchSql.AppendLine("SELECT a.ID                       ");
                searchSql.AppendLine("      ,a.CompanyCD                ");
                searchSql.AppendLine("      ,a.FeesNo                   ");
                searchSql.AppendLine(",(case a.InvoiceType when '1' then '增值税发票' when '2' then '普通地税' when '3' then '普通国税' else '收据' end)InvoiceType  ");
                searchSql.AppendLine(",(case a.FeesType                ");
                searchSql.AppendLine("  when '0' then (case a.ContactType ");
                searchSql.AppendLine("                  when '1' then (select CustName from officedba.ProviderInfo where id=a.ContactUnits) ");
                searchSql.AppendLine("                  when '2' then (select CustName from officedba.CustInfo where id=a.ContactUnits) ");
                searchSql.AppendLine("                  when '3' then (select EmployeeName from officedba.EmployeeInfo where id=a.ContactUnits) ");
                searchSql.AppendLine("                 end) ");
                searchSql.AppendLine(" when '1' then (select CustName from officedba.ProviderInfo where id=a.ContactUnits) ");
                searchSql.AppendLine(" when '2' then (select CustName from officedba.ProviderInfo where id=a.ContactUnits) ");
                searchSql.AppendLine(" when '3' then (select CustName from officedba.ProviderInfo where id=a.ContactUnits) ");
                searchSql.AppendLine(" when '4' then (select CustName from officedba.CustInfo where id=a.ContactUnits)  ");
                searchSql.AppendLine(" when '5' then (select CustName from officedba.CustInfo where id=a.ContactUnits)  ");
                searchSql.AppendLine(" when '6' then (select CustName from officedba.CustInfo where id=a.ContactUnits)  ");
                searchSql.AppendLine(" when '7' then (select EmployeeName from officedba.EmployeeInfo where id=a.ContactUnits) ");
                searchSql.AppendLine(" when '8' then (select CustName from officedba.CustInfo where id=a.ContactUnits)  ");
                searchSql.AppendLine(" when '9' then (select CustName from officedba.ProviderInfo where id=a.ContactUnits) ");
                searchSql.AppendLine(" end) CustName ");
                searchSql.AppendLine("      ,a.ContactUnits                   ");
                searchSql.AppendLine("      , CONVERT(varchar(100), a.CreateDate, 23) CreateDate ");
                searchSql.AppendLine("      ,a.TotalPrice,a.Confirmor,b.EmployeeName  ConfirmorName ");
                searchSql.AppendLine("      , CONVERT(varchar(100), a.ConfirmDate, 23) ConfirmDate ");
                searchSql.AppendLine("      ,(case a.IsAccount when '1' then '已登记' else '未登记' end)IsAccount  ");
                searchSql.AppendLine("  FROM officedba.Fees a ");
                searchSql.AppendLine("  left join officedba.EmployeeInfo b on b.id = a.Confirmor ");
                searchSql.AppendLine(" WHERE a.CompanyCD = @CompanyCD   ");

                #endregion
                #region 定义查询的命令
                SqlCommand comm = new SqlCommand();
                //公司代码
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", CompanyCD));

                //所属项目
                if (!string.IsNullOrEmpty(FeesM.ProjectID))
                {
                    searchSql.AppendLine("	AND a.ProjectID =  @ProjectID ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProjectID", FeesM.ProjectID));
                }

                //编号
                if (!string.IsNullOrEmpty(FeesM.FeesNo))
                {
                    searchSql.AppendLine("	AND a.FeesNo LIKE  '%' + @FeesNo + '%' ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@FeesNo", FeesM.FeesNo));
                }
                //票据类型
                if (FeesM.InvoiceType != "")
                {
                    searchSql.AppendLine("	AND a.InvoiceType =  @InvoiceType ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@InvoiceType", FeesM.InvoiceType));
                }
                //开始时间
                if (DateBegin != "")
                {
                    searchSql.AppendLine("	AND a.CreateDate >= @DateBegin  ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@DateBegin", DateBegin));
                }
                //结束时间
                if (DateEnd != "")
                {
                    searchSql.AppendLine("	AND a.CreateDate <= @DateEnd  ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@DateEnd", DateEnd));
                }
                //金额B
                if (PriceB != "")
                {
                    searchSql.AppendLine("	AND a.TotalPrice >= @PriceB  ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@PriceB", PriceB));
                }
                //金额E
                if (PriceE != "")
                {
                    searchSql.AppendLine("	AND a.TotalPrice <= @PriceE  ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@PriceE", PriceE));
                }
                //源单类型
                if (FeesM.FeesType != "")
                {
                    searchSql.AppendLine("	AND a.FeesType =  @FeesType ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@FeesType", FeesM.FeesType));
                }
                //确认状态
                if (FeesM.ConfirmStatus != "")
                {
                    searchSql.AppendLine("	AND a.ConfirmStatus =  @ConfirmStatus ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@ConfirmStatus", FeesM.ConfirmStatus));
                }
                //是否登记
                if (FeesM.IsAccount != "")
                {
                    searchSql.AppendLine("	AND a.IsAccount  =  @IsAccount  ");
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@IsAccount ", FeesM.IsAccount));
                }
                #endregion

                //设定comm的SQL文
                comm.CommandText = searchSql.ToString();

                //执行查询
                return SqlHelper.ExecuteSearch(comm);
            }
            catch
            {
                return null;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 添加新单据
 /// </summary>
 /// <returns></returns>
 public static bool Insert(FeesModel sellOrderModel, List<FeesDetailModel> sellOrderDetailModellList, out string strMsg,out int Id)
 {
     bool isSucc = false;//是否添加成功
     strMsg = "";
     Id = 0;
     //判断单据编号是否存在
     if (NoIsExist(sellOrderModel.FeesNo))
     {
         TransactionManager tran = new TransactionManager();
         tran.BeginTransaction();
         try
         {
             InsertSellOrder(sellOrderModel, tran,out Id);
             InsertSellOrderDetail(sellOrderDetailModellList, tran);
             if (sellOrderModel.FeesType != "0")
             {
                 //非无源单时,更改源单开票状态
                 updateSourceByFeesType(sellOrderModel.FeesType, sellOrderModel.SourceNo, tran);
             }
             tran.Commit();
             isSucc = true;
             strMsg = "保存成功!";
         }
         catch (Exception ex)
         {
             tran.Rollback();
             strMsg = "保存失败,请联系系统管理员!";
             throw ex;
         }
     }
     else
     {
         isSucc = false;
         strMsg = "该编号已被使用,请输入未使用的编号!";
     }
     return isSucc;
 }
Esempio n. 4
0
        /// <summary>
        /// 跟新主表数据
        /// </summary>
        /// <param name="sellOrderModel"></param>
        /// <param name="tran"></param>
        private static void UpdateSellOrder(FeesModel sellOrderModel, TransactionManager tran)
        {
            StringBuilder strSql = new StringBuilder();
            #region sql语句
            strSql.Append("update officedba.Fees set ");
            strSql.Append("FeesNum=@FeesNum,");
            strSql.Append("FeesType=@FeesType,");
            strSql.Append("InvoiceType=@InvoiceType,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("ContactUnits=@ContactUnits,");
            strSql.Append("ContactType=@ContactType,");
            strSql.Append("AcceWay=@AcceWay,");
            strSql.Append("SubjectsNo=@SubjectsNo,");
            strSql.Append("TotalPrice=@TotalPrice,");
            strSql.Append("Executor=@Executor,");
            strSql.Append("DeptID=@DeptID,");
            strSql.Append("ConfirmStatus=@ConfirmStatus,");
            strSql.Append("Confirmor=@Confirmor,");
            strSql.Append("ConfirmDate=@ConfirmDate,");
            strSql.Append("IsAccount=@IsAccount ,");
            strSql.Append("Accountor =@Accountor ,");
            strSql.Append("AccountDate =@AccountDate ,");
            strSql.Append("SourceNo=@SourceNo,");
            strSql.Append("AccountsStatus=@AccountsStatus,");
            strSql.Append("CurrencyType=@CurrencyType,");
            strSql.Append("CurrencyRate=@CurrencyRate,");
            strSql.Append("ProjectID=@ProjectID,");
            strSql.Append("Note=@Note");
            strSql.Append(" where CompanyCD=@CompanyCD and FeesNo =@FeesNo  ");
            #endregion
           
            SqlParameter[] param = null;
            ArrayList lcmd = new ArrayList();
            #region 参数
            lcmd.Add(SqlHelper.GetParameterFromString("@CompanyCD", sellOrderModel.CompanyCD));
            lcmd.Add(SqlHelper.GetParameterFromString("@FeesNo ", sellOrderModel.FeesNo));
            lcmd.Add(SqlHelper.GetParameterFromString("@FeesNum", sellOrderModel.FeesNum));
            lcmd.Add(SqlHelper.GetParameterFromString("@FeesType", sellOrderModel.FeesType));
            lcmd.Add(SqlHelper.GetParameterFromString("@InvoiceType", sellOrderModel.InvoiceType));
            lcmd.Add(SqlHelper.GetParameterFromString("@CreateDate", sellOrderModel.CreateDate.ToString()));
            lcmd.Add(SqlHelper.GetParameterFromString("@ContactUnits", sellOrderModel.ContactUnits));
            lcmd.Add(SqlHelper.GetParameterFromString("@ContactType", sellOrderModel.ContactType));
            lcmd.Add(SqlHelper.GetParameterFromString("@AcceWay", sellOrderModel.AcceWay));
            lcmd.Add(SqlHelper.GetParameterFromString("@SubjectsNo", sellOrderModel.SubjectsNo));
            lcmd.Add(SqlHelper.GetParameterFromString("@TotalPrice", sellOrderModel.TotalPrice.ToString()));
            lcmd.Add(SqlHelper.GetParameterFromString("@Executor", sellOrderModel.Executor));
            lcmd.Add(SqlHelper.GetParameterFromString("@DeptID", sellOrderModel.DeptID));
            lcmd.Add(SqlHelper.GetParameterFromString("@ConfirmStatus", sellOrderModel.ConfirmStatus));
            lcmd.Add(SqlHelper.GetParameterFromString("@Confirmor", sellOrderModel.Confirmor));
            lcmd.Add(SqlHelper.GetParameterFromString("@ConfirmDate", sellOrderModel.ConfirmDate.ToString()));
            lcmd.Add(SqlHelper.GetParameterFromString("@IsAccount", sellOrderModel.IsAccount));
            lcmd.Add(SqlHelper.GetParameterFromString("@Accountor", sellOrderModel.Accountor));
            lcmd.Add(SqlHelper.GetParameterFromString("@AccountDate", sellOrderModel.AccountDate.ToString()));
            lcmd.Add(SqlHelper.GetParameterFromString("@SourceNo", sellOrderModel.SourceNo));
            lcmd.Add(SqlHelper.GetParameterFromString("@AccountsStatus", sellOrderModel.AccountsStatus));
            lcmd.Add(SqlHelper.GetParameterFromString("@CurrencyType", sellOrderModel.CurrencyType));
            lcmd.Add(SqlHelper.GetParameterFromString("@CurrencyRate", sellOrderModel.CurrencyRate.ToString()));
            lcmd.Add(SqlHelper.GetParameterFromString("@Note", sellOrderModel.Note));
            lcmd.Add(SqlHelper.GetParameterFromString("@ProjectID", sellOrderModel.ProjectID));
                        
            #endregion
          
            if (lcmd != null && lcmd.Count > 0)
            {
                param = new SqlParameter[lcmd.Count];
                for (int i = 0; i < lcmd.Count; i++)
                {
                    param[i] = (SqlParameter)lcmd[i];
                }
            }
            
            foreach (SqlParameter para in param)
            {
                if (para.Value == null)
                {
                    para.Value = DBNull.Value;
                }
            }

            SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), param);
        }
Esempio n. 5
0
        public static bool ConfirmFees(string OrderNO,FeesModel FeesM, List<FeesDetailModel> FeesDetailM, out string strMsg)
        {
            string  CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            string strSq = string.Empty;
            bool isSuc = false;
            strMsg = "";
            //判断单据是否为制单状态,非制单状态不能确认
            if (isHandle(OrderNO, "0"))
            {
                //TransactionManager tran = new TransactionManager();
                //tran.BeginTransaction();
                try
                {                   
                    //判断是否启用自动生成凭证
                    //((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsApply;//自动审核登帐
                    //((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsVoucher;//自动生成凭证
                    if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsVoucher == true)
                    {
                        AttestBillModel Model = new AttestBillModel();//凭证主表实例
                        ArrayList DetailList = new ArrayList();//凭证明细数组
                        Model.CompanyCD = CompanyCD;
                        Model.FromName = "";
                        Model.Attachment = 1;//附件数
                        Model.AttestName = "记账凭证";//凭证名称
                        Model.VoucherDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//凭证日期
                        Model.AttestNo = "记-" + VoucherDBHelper.GetMaxAttestNo(CompanyCD, DateTime.Now.ToString("yyyy-MM-dd"));//凭证号
                        Model.Creator = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID;//制单人
                        Model.CreateDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//制单日期
                        Model.FromTbale = "officedba.Fees";//来源表名
                        Model.FromValue = FeesM.ID;//来源表主键

                        AttestBillDetailsModel DetailModel = new AttestBillDetailsModel();//凭证明细表实例
                        DetailModel.Abstract = FeesM.Note;// dt.Rows[0]["Abstract"].ToString();//摘要
                        DetailModel.CurrencyTypeID = Convert.ToInt32(FeesM.CurrencyType); //币种
                        DetailModel.ExchangeRate = FeesM.CurrencyRate;//汇率
                        DetailModel.SubjectsCD = FeesM.SubjectsNo;//科目编号
                        DetailModel.OriginalAmount = FeesM.TotalPrice;//原币金额
                        DetailModel.DebitAmount = 0;//借方金额
                        DetailModel.CreditAmount = FeesM.TotalPrice * Convert.ToDecimal(FeesM.CurrencyRate);//贷方金额

                        DetailModel.SubjectsDetails = "";
                        DetailModel.FormTBName = "";
                        DetailModel.FileName = "";
                        string Auciliary = VoucherDBHelper.GetSubjectsAuciliaryCD(FeesM.SubjectsNo, CompanyCD);

                        if (Auciliary == "供应商" || Auciliary == "客户" || Auciliary == "职员")
                        {
                            DetailModel.SubjectsDetails = FeesM.ContactUnits;//辅助核算
                            if (Auciliary == "供应商")
                            {
                                DetailModel.FormTBName = "officedba.ProviderInfo";
                                DetailModel.FileName = "CustName";
                            }
                            else if (Auciliary == "客户")
                            {
                                DetailModel.FormTBName = "officedba.CustInfo";
                                DetailModel.FileName = "CustName";
                            }
                            else
                            {
                                DetailModel.FormTBName = "officedba.EmployeeInfo";
                                DetailModel.FileName = "EmployeeName";
                            }
                        }
                        DetailList.Add(DetailModel);


                        //foreach (DataRow row in tempdt.Rows)//根据凭证模板构建凭证明细数组
                        foreach (FeesDetailModel FDetailM in FeesDetailM)
                        {
                            AttestBillDetailsModel DetailM = new AttestBillDetailsModel();//凭证明细表实例
                            DetailM.Abstract = FeesM.Note;//摘要
                            DetailM.CurrencyTypeID = Convert.ToInt32(FeesM.CurrencyType);//币种
                            DetailM.ExchangeRate = FeesM.CurrencyRate;//汇率
                            DetailM.SubjectsCD = FDetailM.SubjectsNo;//科目编号
                            DetailM.OriginalAmount = FDetailM.FeeTotal;//原币金额
                            DetailM.DebitAmount = FDetailM.FeeTotal * Convert.ToDecimal(FeesM.CurrencyRate);//借方金额
                            DetailM.CreditAmount = 0;//贷方金额

                            DetailM.SubjectsDetails = "";
                            DetailM.FormTBName = "";
                            DetailM.FileName = "";

                            DetailList.Add(DetailM);
                        }

                        //自动生成凭证并根据IsApply判断是否登帐 --生成成功
                        int BillID = 0;
                        string IsA = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsApply == true ? "1" : "0";
                        if (VoucherDBHelper.InsertIntoAttestBill(Model, DetailList, out BillID, IsA))
                        {

                            SqlParameter[] paras = new SqlParameter[3];
                            strSq = "update  officedba.Fees set ConfirmStatus='1' , Confirmor=@EmployeeID, ";
                            strSq += " ConfirmDate=getdate(),IsAccount='1',Accountor=@EmployeeID,AccountDate=getdate() ";

                            paras[0] = new SqlParameter("@EmployeeID", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID);
                            paras[1] = new SqlParameter("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD);
                            paras[2] = new SqlParameter("@FeesNo", OrderNO);

                            strSq += " WHERE FeesNo  = @FeesNo  and CompanyCD=@CompanyCD";

                            //SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSq, paras);
                            SqlHelper.ExecuteTransSql(strSq.ToString(), paras);
                            if (SqlHelper.Result.OprateCount > 0)
                            {
                                isSuc = true;
                                strMsg = "确认成功!";
                            }
                            else
                            {
                                isSuc = false;
                                strMsg = "生成凭证失败!";
                            }
                        }
                    }
                    else
                    {
                        SqlParameter[] paras = new SqlParameter[3];
                        strSq = "update  officedba.Fees set ConfirmStatus='1' , Confirmor=@EmployeeID, ";
                        strSq += " ConfirmDate=getdate() ";

                        paras[0] = new SqlParameter("@EmployeeID", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeID);
                        paras[1] = new SqlParameter("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD);
                        paras[2] = new SqlParameter("@FeesNo", OrderNO);

                        strSq += " WHERE FeesNo  = @FeesNo  and CompanyCD=@CompanyCD";

                        SqlHelper.ExecuteTransSql(strSq.ToString(), paras);
                        if (SqlHelper.Result.OprateCount > 0)
                        {
                            isSuc = true;
                            strMsg = "确认成功!";
                        }
                        else
                        {
                            isSuc = false;
                            strMsg = "确认失败!";
                        }
                    }
                }
                catch (Exception ex)
                {
                    
                    //tran.Rollback();

                    isSuc = false;
                    strMsg = "确认失败,请联系系统管理员!";
                    throw ex;
                }
            }
            else
            {
                isSuc = false;
                strMsg = "该单据已被其他用户确认,不可再次确认!";
            }
            return isSuc;
        }
Esempio n. 6
0
 public static bool Update(FeesModel sellOrderModel, List<FeesDetailModel> sellOrderDetailModellList,out string strMsg)
 {
     bool isSucc = false;//是否添加成功
     strMsg = "";
     if (IsUpdate(sellOrderModel.FeesNo))
     {
         string strSql = "delete from officedba.FeesDetail where  FeesNo =@FeesNo   and CompanyCD=@CompanyCD";
         SqlParameter[] paras = { new SqlParameter("@FeesNo ", sellOrderModel.FeesNo ), new SqlParameter("@CompanyCD", sellOrderModel.CompanyCD) };
        // string strSql1 = "delete from officedba.SellOrderFeeDetail where  OrderNo=@OrderNo  and CompanyCD=@CompanyCD";
         TransactionManager tran = new TransactionManager();
         tran.BeginTransaction();
         try
         {
             UpdateSellOrder(sellOrderModel, tran);
             SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, strSql.ToString(), paras);                    
             InsertSellOrderDetail(sellOrderDetailModellList, tran);                  
             tran.Commit();
             isSucc = true;
             strMsg = "保存成功!";
         }
         catch (Exception ex)
         {
             tran.Rollback();
             strMsg = "保存失败,请联系系统管理员!";
             throw ex;
         }
     }
     else
     {
         isSucc = false;
         strMsg = "非制单状态的未提交审批、审批未通过或撤销审批单据不可修改!";
     }
     return isSucc;
 }
Esempio n. 7
0
        /// <summary>
        /// 添加新单据
        /// </summary>
        /// <returns></returns>
        public static bool Insert(FeesModel sellOrderModel, List<FeesDetailModel> sellOrderDetailModellList, out string strMsg,out int Id)
        {
            bool isSuc = false;
            string remark = string.Empty;
            strMsg = "";
            Id = 0;
            try
            {
                isSuc = FeesDBHelper.Insert(sellOrderModel, sellOrderDetailModellList, out  strMsg,out Id);
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            catch 
            {
                ////输出日志
                //SellLogCommon.WriteSystemLog(ex, LogInfo.LogType.SYSTEM, LogInfo.SystemLogKind.SYSTEM_ERROR, ConstUtil.MODULE_ID_SELLORDER_ADD);
                ////设置操作成功标识 
                //remark = ConstUtil.LOG_PROCESS_FAILED;
            }
            //SellLogCommon.InsertLog(sellOrderModel.OrderNo, ConstUtil.MODULE_ID_SELLORDER_ADD, ConstUtil.CODING_RULE_TABLE_SELLORDER, remark, ConstUtil.LOG_PROCESS_INSERT);

            return isSuc;
        }
Esempio n. 8
0
 public static DataTable ExportFeesBySearch(string CompanyCD, FeesModel FeesM, string DateBegin, string DateEnd, string PriceB, string PriceE)
 {
     return FeesDBHelper.ExportFeesBySearch(CompanyCD, FeesM, DateBegin, DateEnd, PriceB, PriceE);
 }
Esempio n. 9
0
 public static bool ConfirmFees(string OrderNO, FeesModel FeesM, List<FeesDetailModel> FeesDetailM, out string strMsg)
 {
     return FeesDBHelper.ConfirmFees(OrderNO,FeesM,FeesDetailM, out strMsg);
 }
Esempio n. 10
0
 public static DataTable GetFeesBySearch(string CompanyCD, FeesModel FeesM, string DateBegin, string DateEnd, string PriceB, string PriceE, int pageIndex, int pageCount, string ord, ref int TotalCount)
 {
     return FeesDBHelper.GetFeesBySearch(CompanyCD, FeesM, DateBegin, DateEnd, PriceB, PriceE, pageIndex, pageCount, ord, ref TotalCount);
 }