} // Consolidate Budgets /// <summary> /// Complete the Budget consolidation process /// </summary> /// <param name="ATransaction"></param> private static void FinishConsolidateBudget( TDBTransaction ATransaction) { /*Consolidate_Budget*/ foreach (ABudgetRow BudgetRow in FBudgetTDS.ABudget.Rows) { BudgetRow.BudgetStatus = true; } ABudgetAccess.SubmitChanges(FBudgetTDS.ABudget, ATransaction); }
private void ConsolidateBudgetsInternal(Int32 ALedgerNumber, bool AConsolidateAll) { TDBTransaction Transaction = new TDBTransaction(); Boolean SubmissionOK = false; TDataBase db = DBAccess.Connect("Budget"); db.WriteTransaction(ref Transaction, ref SubmissionOK, delegate { ALedgerRow LedgerRow = FBudgetTDS.ALedger[0]; // first clear the old budget from GLMPeriods if (AConsolidateAll) { foreach (ABudgetRow BudgetRow in FBudgetTDS.ABudget.Rows) { BudgetRow.BudgetStatus = false; } foreach (AGeneralLedgerMasterRow GeneralLedgerMasterRow in FGLPostingDS.AGeneralLedgerMaster.Rows) { for (int Period = 1; Period <= LedgerRow.NumberOfAccountingPeriods; Period++) { ClearAllBudgetValues(GeneralLedgerMasterRow.GlmSequence, Period); } } } else { foreach (ABudgetRow BudgetRow in FBudgetTDS.ABudget.Rows) { if (!BudgetRow.BudgetStatus) { UnPostBudget(BudgetRow, ALedgerNumber); } } } foreach (ABudgetRow BudgetRow in FBudgetTDS.ABudget.Rows) { if (!BudgetRow.BudgetStatus || AConsolidateAll) { List <ABudgetPeriodRow> budgetPeriods = new List <ABudgetPeriodRow>(); FBudgetTDS.ABudgetPeriod.DefaultView.RowFilter = ABudgetPeriodTable.GetBudgetSequenceDBName() + " = " + BudgetRow.BudgetSequence.ToString(); foreach (DataRowView rv in FBudgetTDS.ABudgetPeriod.DefaultView) { budgetPeriods.Add((ABudgetPeriodRow)rv.Row); } PostBudget(ALedgerNumber, BudgetRow, budgetPeriods); } } /*Consolidate_Budget*/ foreach (ABudgetRow BudgetRow in FBudgetTDS.ABudget.Rows) { BudgetRow.BudgetStatus = true; } ABudgetAccess.SubmitChanges(FBudgetTDS.ABudget, Transaction); FGLPostingDS.ThrowAwayAfterSubmitChanges = true; GLPostingTDSAccess.SubmitChanges(FGLPostingDS, Transaction.DataBaseObj); FGLPostingDS.Clear(); SubmissionOK = true; }); }