private void SetupGrid() { grdDetails.Columns.Clear(); grdDetails.AddTextColumn(Catalog.GetString("Currency Code"), FMainDS.AAccount.ColumnForeignCurrencyCode); grdDetails.AddTextColumn(Catalog.GetString("Account Code"), FMainDS.AAccount.ColumnAccountCode); grdDetails.AddTextColumn(Catalog.GetString("Description"), FMainDS.AAccount.ColumnAccountCodeShortDesc); grdDetails.AddCurrencyColumn(Catalog.GetString("YTD Total"), FForeignCurrencyAccountsDT.Columns[AGeneralLedgerMasterTable.GetYtdActualForeignDBName()]); grdDetails.AddCurrencyColumn(Catalog.GetString("YTD Total (BASE)"), FForeignCurrencyAccountsDT.Columns[AGeneralLedgerMasterTable.GetYtdActualBaseDBName()]); }
public static void GetForeignCurrencyAccountActuals(ref DataTable AForeignCurrencyAccounts, Int32 ALedgerNumber, Int32 AYear) { DataTable ForeignCurrencyAccounts = AForeignCurrencyAccounts; TDBTransaction Transaction = new TDBTransaction(); TDataBase db = DBAccess.Connect("GetForeignCurrencyAccountActuals"); db.ReadTransaction(ref Transaction, delegate { AGeneralLedgerMasterTable glmTbl = new AGeneralLedgerMasterTable(); AGeneralLedgerMasterRow GLMTemplateRow = glmTbl.NewRowTyped(false); foreach (DataRow ForeignCurrencyAccountRow in ForeignCurrencyAccounts.Rows) { GLMTemplateRow.LedgerNumber = ALedgerNumber; GLMTemplateRow.Year = AYear; GLMTemplateRow.AccountCode = ForeignCurrencyAccountRow[AAccountTable.GetAccountCodeDBName()].ToString(); glmTbl = AGeneralLedgerMasterAccess.LoadUsingTemplate(GLMTemplateRow, Transaction); Decimal YtdActual = 0; Decimal YtdActualForeign = 0; if (glmTbl != null) { // // I need to sum up all the GLM entries for this account: foreach (AGeneralLedgerMasterRow glmRow in glmTbl.Rows) { if (!glmRow.IsYtdActualForeignNull()) { YtdActualForeign += glmRow.YtdActualForeign; } YtdActual += glmRow.YtdActualBase; } } ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualBaseDBName()] = YtdActual; ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualForeignDBName()] = YtdActualForeign; } }); db.CloseDBConnection(); }
public static void GetForeignCurrencyAccountActuals(ref DataTable AForeignCurrencyAccounts, Int32 ALedgerNumber, Int32 AYear) { //string ReturnValue = ""; DataTable ForeignCurrencyAccounts = AForeignCurrencyAccounts.Clone(); ForeignCurrencyAccounts.Merge(AForeignCurrencyAccounts); string CostCentreCode = "[" + ALedgerNumber + "]"; TDBTransaction Transaction = null; DBAccess.GDBAccessObj.BeginAutoReadTransaction(ref Transaction, delegate { foreach (DataRow ForeignCurrencyAccountRow in ForeignCurrencyAccounts.Rows) { AGeneralLedgerMasterTable Table = AGeneralLedgerMasterAccess.LoadByUniqueKey( ALedgerNumber, AYear, ForeignCurrencyAccountRow[AAccountTable.GetAccountCodeDBName()].ToString(), CostCentreCode, Transaction); if ((Table != null) && (Table.Rows.Count > 0)) { AGeneralLedgerMasterRow Row = Table[0]; if (Row.IsYtdActualForeignNull()) { ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualForeignDBName()] = 0; } else { ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualForeignDBName()] = Row.YtdActualForeign; } ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualBaseDBName()] = Row.YtdActualBase; } else { ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualForeignDBName()] = 0; ForeignCurrencyAccountRow[AGeneralLedgerMasterTable.GetYtdActualBaseDBName()] = 0; } } }); AForeignCurrencyAccounts = ForeignCurrencyAccounts; }