/// <summary> /// 修改时获取勾兑明细记录 /// </summary> /// <param name="BillingID">业务单ID</param> /// <param name="PayOrIncomeType">收付款单类别</param> /// <param name="PayOrInComeID">收付款单ID</param> /// <param name="CompanyCD">公司编码</param> /// <returns></returns> public bool UpdateEditBlending(int BillingID, string PayOrIncomeType, string CompanyCD, int PayOrInComeID) { try { int rev = 0; DataTable dt = GetBlendingSourse(CompanyCD, BillingID.ToString(), PayOrIncomeType); foreach (DataRow dr in dt.Rows) { decimal YAccounts = 0; decimal NAccounts = 0; DataTable steps = StepsDetailsDBHelper.GetStepsDetails(PayOrInComeID, int.Parse(dr["ID"].ToString()), CompanyCD, PayOrIncomeType); if (steps.Rows.Count > 0) { YAccounts = Convert.ToDecimal(dr["YAccounts"].ToString()) - Convert.ToDecimal(steps.Rows[0]["BlendingAmount"].ToString()); NAccounts = Convert.ToDecimal(dr["NAccounts"].ToString()) + Convert.ToDecimal(steps.Rows[0]["BlendingAmount"].ToString()); string sql = "Update officedba.BlendingDetails set YAccounts=@YAccounts,NAccounts=@NAccounts where ID=@ID"; SqlParameter[] parms = { new SqlParameter("@YAccounts", YAccounts), new SqlParameter("@NAccounts", NAccounts), new SqlParameter("@ID", dr["ID"].ToString()), }; SqlHelper.ExecuteTransSql(sql, parms); rev += SqlHelper.Result.OprateCount; } } return(rev > 0 ? true : false); } catch (Exception ex) { throw ex; } }
/// <summary> /// 修改时获取勾兑明细记录 /// </summary> /// <param name="BillingID">业务单ID</param> /// <param name="PayOrIncomeType">收付款单类别</param> /// <param name="PayOrInComeID">收付款单ID</param> /// <param name="CompanyCD">公司编码</param> /// <returns></returns> public DataTable GetEditBlendingSource(int BillingID, string PayOrIncomeType, string CompanyCD, int PayOrInComeID) { try { DataTable dt = GetBlendingSourse(CompanyCD, BillingID.ToString(), PayOrIncomeType); DataTable SourceDt = dt.Clone(); SourceDt.Clear(); SourceDt.Columns.Add("ThisAccounts"); foreach (DataRow dr in dt.Rows) { DataRow row = SourceDt.NewRow(); row["ID"] = dr["ID"].ToString(); row["PayOrInComeType"] = dr["PayOrInComeType"].ToString(); row["BillingID"] = dr["BillingID"].ToString(); row["SourceDt"] = dr["SourceDt"].ToString(); row["SourceID"] = dr["SourceID"].ToString(); row["BillCD"] = dr["BillCD"].ToString(); row["BillingType"] = dr["BillingType"].ToString(); row["InvoiceType"] = dr["InvoiceType"].ToString(); row["TotalPrice"] = dr["TotalPrice"].ToString(); row["CreateDate"] = dr["CreateDate"].ToString(); row["ContactUnits"] = dr["ContactUnits"].ToString(); row["ExecutDate"] = dr["ExecutDate"].ToString(); row["Executor"] = dr["Executor"].ToString(); row["CurrencyName"] = dr["CurrencyName"].ToString(); row["Rate"] = dr["Rate"].ToString(); row["CurrencyType"] = dr["CurrencyType"].ToString(); DataTable steps = StepsDetailsDBHelper.GetStepsDetails(PayOrInComeID, int.Parse(dr["ID"].ToString()), CompanyCD, PayOrIncomeType); if (steps.Rows.Count > 0) { row["YAccounts"] = Convert.ToDecimal(dr["YAccounts"].ToString()) - Convert.ToDecimal(steps.Rows[0]["BlendingAmount"].ToString()); row["NAccounts"] = Convert.ToDecimal(dr["NAccounts"].ToString()) + Convert.ToDecimal(steps.Rows[0]["BlendingAmount"].ToString()); row["ThisAccounts"] = steps.Rows[0]["BlendingAmount"].ToString(); } SourceDt.Rows.Add(row); } return(SourceDt); } catch (Exception ex) { throw ex; } }