private static bool TrainBankStatementsLastMonthThread(String ASessionID, Int32 AClientID, Int32 ALedgerNumber, DateTime AToday) { TSession.InitThread(ASessionID); DomainManager.GClientID = AClientID; string MyClientID = DomainManager.GClientID.ToString(); TProgressTracker.InitProgressTracker(MyClientID, Catalog.GetString("Training last months bank statements"), 30); DateTime startDateThisMonth = new DateTime(AToday.Year, AToday.Month, 1); DateTime endDateLastMonth = startDateThisMonth.AddDays(-1); DateTime startDateLastMonth = new DateTime(endDateLastMonth.Year, endDateLastMonth.Month, 1); // get all bank accounts TCacheable CachePopulator = new TCacheable(); Type typeofTable; GLSetupTDSAAccountTable accounts = (GLSetupTDSAAccountTable)CachePopulator.GetCacheableTable( TCacheableFinanceTablesEnum.AccountList, "", false, ALedgerNumber, out typeofTable); foreach (GLSetupTDSAAccountRow account in accounts.Rows) { // at OM Germany we don't have the bank account flags set if ((!account.IsBankAccountFlagNull() && (account.BankAccountFlag == true)) || (!account.IsCashAccountFlagNull() && (account.CashAccountFlag == true)) ) { string BankAccountCode = account.AccountCode; DateTime counter = startDateLastMonth; while (!counter.Equals(startDateThisMonth)) { TProgressTracker.SetCurrentState( MyClientID, String.Format(Catalog.GetString("Training {0} {1}"), BankAccountCode, counter.ToShortDateString()), counter.Day); // TODO: train only one bank statement per date and bank account? TrainBankStatement(ALedgerNumber, counter, BankAccountCode); counter = counter.AddDays(1); } } } TProgressTracker.FinishJob(MyClientID); return(true); }
/// <summary> /// Implementation of the logic for setting the filter string for the accounts list screen /// </summary> /// <param name="AFilterString">The desired filter string</param> /// <param name="AAccountTable">The table instance that is being used for the data</param> public void ApplyFilterManual(ref string AFilterString, GLSetupTDSAAccountTable AAccountTable) { string filter = String.Empty; if (FFilterTxtAccountCode.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '%{1}%')", AAccountTable.ColumnAccountCode, FFilterTxtAccountCode.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterCmbAccountType.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '{1}')", AAccountTable.ColumnAccountType, FFilterCmbAccountType.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterTxtDescrEnglish.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '%{1}%')", AAccountTable.ColumnEngAccountCodeLongDesc, FFilterTxtDescrEnglish.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterTxtDescrLocal.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '%{1}%')", AAccountTable.ColumnAccountCodeLongDesc, FFilterTxtDescrLocal.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterChkBankAccount.CheckState != CheckState.Indeterminate) { if (FFilterChkBankAccount.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnBankAccountFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnBankAccountFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FSuspenseAccountsAllowed && (FFilterChkSuspenseAccount.CheckState != CheckState.Indeterminate)) { if (FFilterChkSuspenseAccount.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnSuspenseAccountFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnSuspenseAccountFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FFilterChkActive.CheckState != CheckState.Indeterminate) { if (FFilterChkActive.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnAccountActiveFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnAccountActiveFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FFilterChkSummary.CheckState != CheckState.Indeterminate) { if (!FFilterChkSummary.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnPostingStatus), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnPostingStatus), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FFilterChkForeign.CheckState != CheckState.Indeterminate) { if (FFilterChkForeign.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnForeignCurrencyFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnForeignCurrencyFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } AFilterString = filter; }
/// <summary> /// Implementation of the logic for setting the filter string for the accounts list screen /// </summary> /// <param name="AFilterString">The desired filter string</param> /// <param name="AAccountTable">The table instance that is being used for the data</param> public void ApplyFilterManual(ref string AFilterString, GLSetupTDSAAccountTable AAccountTable) { string filter = String.Empty; if (FFilterTxtAccountCode.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '%{1}%')", AAccountTable.ColumnAccountCode, FFilterTxtAccountCode.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterCmbAccountType.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '{1}')", AAccountTable.ColumnAccountType, FFilterCmbAccountType.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterTxtDescrEnglish.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '%{1}%')", AAccountTable.ColumnEngAccountCodeLongDesc, FFilterTxtDescrEnglish.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterTxtDescrLocal.Text != String.Empty) { StringHelper.JoinAndAppend(ref filter, String.Format("({0} LIKE '%{1}%')", AAccountTable.ColumnAccountCodeLongDesc, FFilterTxtDescrLocal.Text), CommonJoinString.JOIN_STRING_SQL_AND); } if (FFilterChkBankAccount.CheckState != CheckState.Indeterminate) { if (FFilterChkBankAccount.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnBankAccountFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnBankAccountFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FFilterChkActive.CheckState != CheckState.Indeterminate) { if (FFilterChkActive.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnAccountActiveFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnAccountActiveFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FFilterChkSummary.CheckState != CheckState.Indeterminate) { if (!FFilterChkSummary.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnPostingStatus), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnPostingStatus), CommonJoinString.JOIN_STRING_SQL_AND); } } if (FFilterChkForeign.CheckState != CheckState.Indeterminate) { if (FFilterChkForeign.Checked) { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=1)", AAccountTable.ColumnForeignCurrencyFlag), CommonJoinString.JOIN_STRING_SQL_AND); } else { StringHelper.JoinAndAppend(ref filter, String.Format("({0}=0 OR {0} IS NULL)", AAccountTable.ColumnForeignCurrencyFlag), CommonJoinString.JOIN_STRING_SQL_AND); } } AFilterString = filter; }