/// <summary> /// todoComment /// </summary> /// <param name="AGridDataView"></param> /// <param name="APreselectedSiteKey"></param> /// <param name="ARowNumber"></param> /// <param name="ASiteKey"></param> public void DetermineInitiallySelectedSite(DataView AGridDataView, Int64 APreselectedSiteKey, out Int32 ARowNumber, out Int64 ASiteKey) { System.Int16 CurrentRow; if ((APreselectedSiteKey == 0) || (APreselectedSiteKey == -1)) { ASiteKey = Convert.ToInt64(TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY)); } else { ASiteKey = APreselectedSiteKey; } FSiteKey = ASiteKey; ARowNumber = 0; for (CurrentRow = 0; CurrentRow <= AGridDataView.Count - 1; CurrentRow += 1) { ARowNumber = ARowNumber + 1; if (Convert.ToInt64(AGridDataView[CurrentRow].Row[PPartnerLedgerTable.GetPartnerKeyDBName()]) == ASiteKey) { break; } } }
private void LoadReportParams(TRptCalculator ACalc) { // Add standard parameters for the report header ACalc.GetParameters().Add("param_requested_by", UserInfo.GUserInfo.UserID); Version ClientVersion = Assembly.GetAssembly(typeof(FastReportsWrapper)).GetName().Version; ACalc.GetParameters().Add("param_version", ClientVersion.Major.ToString() + "." + ClientVersion.Minor.ToString() + "." + ClientVersion.Build.ToString() + "." + ClientVersion.Revision.ToString()); // // Some params are always provided for reports: bool TaxDeductiblePercentageEnabled = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false); ACalc.AddParameter("param_tax_deductible_pct", TaxDeductiblePercentageEnabled); ArrayList reportParam = ACalc.GetParameters().Elems; MethodInfo FastReport_SetParameterValue = FFastReportType.GetMethod("SetParameterValue"); foreach (Shared.MReporting.TParameter p in reportParam) { if (p.name.StartsWith("param") && (p.name != "param_calculation")) { FastReport_SetParameterValue.Invoke(FfastReportInstance, new object[] { p.name, p.value.ToObject() }); } } }
/// <summary> /// Gets called in regular intervals from a Timer in Class TTimedProcessing. /// </summary> /// <param name="ADBAccessObj">Instantiated DB Access object with opened DB connection.</param> /// <param name="ARunManually">this is true if the process was called manually from the server admin console</param> public static void Process(TDataBase ADBAccessObj, bool ARunManually) { // only check once a day (or as specified in config file), if not manually called if (!ARunManually) { DateTime LastRun = TVariant.DecodeFromString( TSystemDefaults.GetSystemDefault( PROCESSDATACHECK_LAST_RUN, new TVariant(DateTime.MinValue).EncodeToString())).ToDate(); if (LastRun.AddDays(TAppSettingsManager.GetInt16("DataChecks.RunEveryXDays", 1)) > DateTime.Now) { // do not run the data check more than once a day or a week (depending on configuration setting), too many emails TLogging.LogAtLevel(1, "TProcessDataChecks.Process: not running, since last run was at " + LastRun.ToString()); return; } } Errors_SinceDate = DateTime.Today.AddDays(-1 * SENDREPORTFORDAYS_TOUSERS); TLogging.LogAtLevel(1, "TProcessDataChecks.Process: Checking Modules"); CheckModule(ADBAccessObj, "DataCheck.MPartner."); TSystemDefaults.SetSystemDefault(PROCESSDATACHECK_LAST_RUN, new TVariant(DateTime.Now).EncodeToString()); }
private void InitializeManualCode() { tabGiftBatch.Selecting += new TabControlCancelEventHandler(TabSelectionChanging); this.tpgRecurringTransactions.Enabled = false; // read system and user defaults bool DonorZeroIsValid = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DONORZEROISVALID, false); bool RecipientZeroIsValid = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_RECIPIENTZEROISVALID, false); //If user is FINANCE-3 level then their user settings can override system level setting FDonorZeroIsValid = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_DONOR_ZERO_IS_VALID, DonorZeroIsValid); FRecipientZeroIsValid = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_RECIPIENT_ZERO_IS_VALID, RecipientZeroIsValid); //Use the same setting as for posting FWarnOfInactiveValuesOnSubmitting = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_WARN_OF_INACTIVE_VALUES_ON_POSTING, true); FNewDonorWarning = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_NEW_DONOR_ALERT, true); mniNewDonorWarning.Checked = FNewDonorWarning; // only add this event if the user want a new donor warning (this will still work without the condition) if (FNewDonorWarning) { FPetraUtilsObject.DataSaved += new TDataSavedHandler(FPetraUtilsObject_DataSaved); } mniFilePrint.Enabled = true; // change the event that gets called when 'Save' is clicked (i.e. changed from generated code) tbbSave.Click -= FileSave; mniFileSave.Click -= FileSave; tbbSave.Click += FileSaveManual; mniFileSave.Click += FileSaveManual; tabGiftBatch.GotFocus += new EventHandler(tabGiftBatch_GotFocus); }
/// <summary> /// If the wrapper didn't initialise, the caller can call this. /// </summary> public void ShowErrorPopup() { // Note from AlanP: This method will show an appropriate Fast Reports error message box depending on the InitState // We want to show this error if FastReports is supposed to be used but is not installed. // We do not want to show it if FastReports is NOT supposed to be used.... // If FastReports is not supposed to be used the database will have an entry: USEXMLREPORTS (in system defaults table) // However the only quirk to this simple arrangement is that in OM we do want to use FastReports - but it does not HAVE to be installed // in many circumstances. It may well not be installed on our continuous integration server for example. // When the CI server runs the test suite, one of the tests is to open all the main screens from the main menu. // It does this on a 'new', 'blank' database which will not have 'USEXMLREPORTS' in the defaults table. // As a result the test fails because an unexpected modal dialog appears that is not dealt with // So we would like to know if the method is being run in the context of a test or not. // We achieve this by the first line of code in the method. // If FPetraUtilsObject is null, this wrapper has been created using the constructor that specifies the ReportName. // This is never used (at present anyway) in the context of a test. // If FPetraUtilsObject is non-null, we can always (at present) detect the difference between a screen opened from the main menu and a screen opened for a test // because, in the latter case, the CallerForm will be null. // If, in the future, this 'workaround' can no longer be used (because we start to use a FastReports test?), we will have to do things differently. Boolean IsTestContext = (FPetraUtilsObject != null) && (FPetraUtilsObject.GetCallerForm() == null); if ((TSystemDefaults.GetSystemDefault("USEXMLREPORTS", "Not Specified") == "Not Specified") && !IsTestContext) { String Msg = ""; switch (FInitState) { case TInitState.LoadDll: { Msg = "failed to load FastReport Dll."; break; } case TInitState.LoadTemplate: { Msg = String.Format("no reporting template found for {0}.", FReportName); break; } case TInitState.InitSystem: { Msg = "the DLL failed to initialise."; break; } default: { return; // Anything else is not an error... } } MessageBox.Show("The FastReports plugin did not initialise:\r\n" + Msg + "\r\n(To suppress this message, set USEXMLREPORTS in SystemDefaults.)", "Reporting engine"); } }
private void NewRowManual(ref PmStaffDataRow ARow) { ARow.Key = Convert.ToInt32(TRemote.MCommon.WebConnectors.GetNextSequence(TSequenceNames.seq_staff_data)); ARow.PartnerKey = FMainDS.PPerson[0].PartnerKey; ARow.ReceivingField = 0; ARow.SetReceivingFieldOfficeNull(); ARow.OfficeRecruitedBy = TSystemDefaults.GetSiteKeyDefault(); ARow.HomeOffice = TSystemDefaults.GetSiteKeyDefault(); ARow.StartOfCommitment = DateTime.Now.Date; }
private void InitializeManualCode() { // set the number of days to default according to settings used in System Manager String NumberOfDays = TSystemDefaults.GetStringDefault (SharedConstants.SYSDEFAULT_PURGEEXTRACTS, "no,365").Split(',')[1]; txtNumberOfDays.NumberValueInt = Convert.ToInt32(NumberOfDays); FPurgingSuccessful = false; }
private void RunOnceOnActivationManual() { Boolean useGovId = TSystemDefaults.GetBooleanDefault("GovIdEnabled", false); if (useGovId) { pnlRequireBpkCode.Visible = true; chkRequireBpkCode.CheckedChanged += ChkRequireBpkCode_CheckedChanged; chkRequireNoBpkCode.CheckedChanged += ChkRequireNoBpkCode_CheckedChanged; } }
private void UpdateDefaultCombobox(Boolean ADuringScreenActivation) { // update default combobox String SelectedSites = clbSites.GetCheckedStringList(); Int64 SelectedDefaultSite = 0; String SiteName; // remember original selection for default site if (ADuringScreenActivation) { SelectedDefaultSite = Convert.ToInt64(TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY)); } else { if (cmbDefaultSite.SelectedValue != null) { SelectedDefaultSite = Convert.ToInt64(cmbDefaultSite.SelectedValue); } } String[] SiteKeyArray = SelectedSites.Split(','); Int32 Counter = 0; // initialize data table for combobox CmbDataTable.Clear(); for (Counter = 0; Counter < SiteKeyArray.Length; Counter++) { if (SiteKeyArray[Counter] != "") { // find site name for given key ("Find" does not work on DataTable as it does not have primary key) SiteName = ""; foreach (DataRow SiteRow in AvailableSitesTable.Rows) { if (Convert.ToInt64(SiteRow[PUnitTable.GetPartnerKeyDBName()]) == Convert.ToInt64(SiteKeyArray[Counter])) { SiteName = SiteRow[PUnitTable.GetUnitNameDBName()].ToString(); break; } } CmbDataTable.Rows.Add(string.Format("{0:0000000000}", Convert.ToInt64(SiteKeyArray[Counter])) + " - " + SiteName, Convert.ToInt64(SiteKeyArray[Counter])); } } // now reselected the original selected default site if (SelectedDefaultSite > 0) { cmbDefaultSite.SelectedValue = SelectedDefaultSite; } }
private void InitializeManualCode() { FDonorZeroIsValidSystemDefault = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_DONORZEROISVALID, false); FRecipientZeroIsValidSystemDefault = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_RECIPIENTZEROISVALID, false); FInitiallySelectedLedger = TLstTasks.InitiallySelectedLedger; //New Donor alert FNewDonorAlert = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_NEW_DONOR_ALERT, true); chkNewDonorAlert.Checked = FNewDonorAlert; //Donor zero is valid FDonorZeroIsValid = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_DONOR_ZERO_IS_VALID, FDonorZeroIsValidSystemDefault); chkDonorZeroIsValid.Checked = FDonorZeroIsValid; //Auto-copying fields FAutoCopyIncludeMailingCode = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_AUTO_COPY_INCLUDE_MAILING_CODE, false); chkAutoCopyIncludeMailingCode.Checked = FAutoCopyIncludeMailingCode; FAutoCopyIncludeComments = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_AUTO_COPY_INCLUDE_COMMENTS, false); chkAutoCopyIncludeComments.Checked = FAutoCopyIncludeComments; //Recipient zero is valid FRecipientZeroIsValid = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_RECIPIENT_ZERO_IS_VALID, FRecipientZeroIsValidSystemDefault); chkRecipientZeroIsValid.Checked = FRecipientZeroIsValid; //Allow auto-saving of form FAutoSave = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_AUTO_SAVE, false); chkAutoSave.Checked = FAutoSave; //Warn of inactive values on posting FWarnOfInactiveValuesOnPosting = TUserDefaults.GetBooleanDefault(TUserDefaults.FINANCE_GIFT_WARN_OF_INACTIVE_VALUES_ON_POSTING, true); chkWarnOfInactiveValuesOnPosting.Checked = FWarnOfInactiveValuesOnPosting; //Only highest level finance users can change these settings if (!UserInfo.GUserInfo.IsInModule("FINANCE-3")) { chkDonorZeroIsValid.Enabled = false; chkRecipientZeroIsValid.Enabled = false; } else { chkDonorZeroIsValid.CheckStateChanged += new System.EventHandler(ConfirmDonorZeroChange); chkRecipientZeroIsValid.CheckStateChanged += new System.EventHandler(ConfirmRecipientZeroChange); } }
public static bool LoadDefaultMotivation(Int32 ALedgerNumber, out string ADefaultMotivationGroup, out string ADefaultMotivationDetail) { ADefaultMotivationGroup = String.Empty; ADefaultMotivationDetail = String.Empty; string DefaultMotivation = new TSystemDefaults().GetSystemDefault("DEFAULTMOTIVATION" + ALedgerNumber.ToString()); if (DefaultMotivation != SharedConstants.SYSDEFAULT_NOT_FOUND) { ADefaultMotivationGroup = DefaultMotivation.Substring(0, DefaultMotivation.IndexOf("::")); ADefaultMotivationDetail = DefaultMotivation.Substring(DefaultMotivation.IndexOf("::") + 2); return(true); } return(false); }
private void InitializeManualCode() { string MySettings = TSystemDefaults.GetSystemDefault("IntranetExportSettings", "pswd,45,"); string[] Setting = MySettings.Split(','); if (Setting.Length > 2) { FPswd = Setting[0]; FGiftDays = Convert.ToInt32(Setting[1]); FExtra = Setting[2]; } FReplyToEmail = TUserDefaults.GetStringDefault("ReplyToEmail"); FServerAddress = TUserDefaults.GetStringDefault("IntranetServerAddress"); }
/// <summary> /// Save a failed user login attempt. If the number of permitted failed logins in a row gets exceeded then the /// user account gets Locked, too! /// </summary> /// <param name="AUserID">User ID.</param> /// <param name="UserDR">s_user DataRow of the user.</param> /// <param name="AClientComputerName">Name of the Client Computer that the authentication request came from.</param> /// <param name="AClientIPAddress">IP Address of the Client Computer that the authentication request came from.</param> /// <param name="ATransaction">Instantiated DB Transaction.</param> private static void SaveFailedLogin(string AUserID, SUserRow UserDR, string AClientComputerName, string AClientIPAddress, TDBTransaction ATransaction) { int AProcessID; int FailedLoginsUntilAccountGetsLocked = TSystemDefaults.GetInt32Default(SharedConstants.SYSDEFAULT_FAILEDLOGINS_UNTIL_ACCOUNT_GETS_LOCKED, 10); bool AccountLockedAtThisAttempt = false; // Console.WriteLine('PetraPrincipal.PetraIdentity.FailedLogins: ' + PetraPrincipal.PetraIdentity.FailedLogins.ToString + // '; PetraPrincipal.PetraIdentity.AccountLocked: ' + PetraPrincipal.PetraIdentity.AccountLocked.ToString); UserDR.FailedLogins++; UserDR.FailedLoginDate = DateTime.Now; UserDR.FailedLoginTime = Conversions.DateTimeToInt32Time(UserDR.FailedLoginDate.Value); // Check if User Account should be Locked due to too many successive failed log-in attempts if ((UserDR.FailedLogins >= FailedLoginsUntilAccountGetsLocked) && ((!UserDR.AccountLocked))) { // Lock User Account (this user will no longer be able to log in until a Sysadmin resets this flag!) UserDR.AccountLocked = true; AccountLockedAtThisAttempt = true; TUserAccountActivityLog.AddUserAccountActivityLogEntry(UserDR.UserId, TUserAccountActivityLog.USER_ACTIVITY_PERMITTED_FAILED_LOGINS_EXCEEDED, String.Format(Catalog.GetString( "The permitted number of failed logins in a row got exceeded and the user account for the user {0} got locked! ") + String.Format(ResourceTexts.StrRequestCallerInfo, AClientComputerName, AClientIPAddress), UserDR.UserId), ATransaction); } // Logging TLoginLog.AddLoginLogEntry(AUserID, AccountLockedAtThisAttempt ? TLoginLog.LOGIN_STATUS_TYPE_LOGIN_ATTEMPT_PWD_WRONG_ACCOUNT_GOT_LOCKED : TLoginLog.LOGIN_STATUS_TYPE_LOGIN_ATTEMPT_PWD_WRONG, String.Format(Catalog.GetString("User supplied wrong password{0}! (Failed Logins: now {1}; " + "Account Locked: now {2}, User Retired: {3}) "), (AccountLockedAtThisAttempt ? Catalog.GetString("; because the permitted number of failed logins in a row got exceeded the user account " + "for the user got locked! ") : String.Empty), UserDR.FailedLogins, UserDR.AccountLocked, UserDR.Retired) + String.Format(ResourceTexts.StrRequestCallerInfo, AClientComputerName, AClientIPAddress), out AProcessID, ATransaction); SaveUser(AUserID, (SUserTable)UserDR.Table, ATransaction); }
private void RunOnceOnActivationManual() { // AlanP March 2013: Use a try/catch block because nUnit testing on this screen does not support Drag/Drop in multi-threaded model // It is easier to do this than to configure all the different test execution methods to use STA try { trvUnits.AllowDrop = true; trvUnits.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(treeView_ItemDrag); trvUnits.DragOver += new System.Windows.Forms.DragEventHandler(treeView_DragOver); trvUnits.DragDrop += new System.Windows.Forms.DragEventHandler(treeView_DragDrop); } catch (InvalidOperationException) { // ex.Message is: DragDrop registration did not succeed. // Inner exception is: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. } trvUnits.Click += new EventHandler(UnitsClick); trvUnits.ShowNodeToolTips = true; trvUnits.MouseWheel += new MouseEventHandler(treeView_MouseWheel); trvUnits.Focus(); txtChild.TextChanged += new EventHandler(EvaluateParentChange); txtParent.TextChanged += new EventHandler(EvaluateParentChange); FPetraUtilsObject.UnhookControl(pnlDetails, true); // I don't want changes in these values to cause SetChangedFlag. FPetraUtilsObject.UnhookControl(txtStatus, false); ArrayList UnitNodes = TRemote.MPersonnel.WebConnectors.GetUnitHeirarchy(); // // The list of nodes returned by the above call are ordered to the extent that: // * The root node appears first, // * a parent appears before its child. UnitHierarchyNode RootData = (UnitHierarchyNode)UnitNodes[0]; TreeNode RootNode = new TreeNode(RootData.Description); RootNode.Tag = RootData; RootNode.ToolTipText = RootData.TypeCode; UnitNodes.RemoveAt(0); trvUnits.Nodes.Add(RootNode); AddChildren(RootNode, UnitNodes); Int64 MySiteKey = Convert.ToInt64(TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY, "")); ShowThisUnit(MySiteKey); }
private void InitializeManualCode() { // set the number of days to default according to settings used in System Manager String NumberOfDays = TSystemDefaults.GetStringDefault (SharedConstants.SYSDEFAULT_PURGEEXTRACTS, "no,365").Split(',')[1]; txtNumberOfDays.NumberValueInt = Convert.ToInt32(NumberOfDays); if ((UserInfo.GUserInfo.IsInModule("PTNRADMIN") == false) && (TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_MODIFY_PUBLIC_EXTRACTS_REQUIRES_ADMIN, false) == true)) { FRestrictToCurrentClient = true; chkAllUsers.Enabled = false; cmbUser.SetSelectedString(UserInfo.GUserInfo.UserID); cmbUser.Enabled = false; } FPurgingSuccessful = false; }
/// <summary> /// add a new short term application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewRowShortTermApp(System.Object sender, EventArgs e) { // Clear any validation errors so that the following call to ValidateAllData starts with a 'clean slate'. FPetraUtilsObject.VerificationResultCollection.Clear(); if (ValidateAllData(true, TErrorProcessingMode.Epm_IgnoreNonCritical)) { // we create the table locally, no dataset IndividualDataTDSPmGeneralApplicationRow NewRowGeneralApp = FMainDS.PmGeneralApplication.NewRowTyped(true); PmShortTermApplicationRow NewRowShortTermApp = FMainDS.PmShortTermApplication.NewRowTyped(true); NewRowGeneralApp.PartnerKey = FMainDS.PPerson[0].PartnerKey; NewRowGeneralApp.ApplicationKey = GetNextApplicationKey(); NewRowGeneralApp.RegistrationOffice = TSystemDefaults.GetSiteKeyDefault(); NewRowGeneralApp.GenAppDate = DateTime.Today; NewRowGeneralApp.ApplicationForEventOrField = Catalog.GetString("Event"); //TODO temp, needs to be changed NewRowGeneralApp.AppTypeName = "CONFERENCE"; NewRowGeneralApp.OldLink = TSystemDefaults.GetSiteKeyDefault().ToString() + ";" + NewRowGeneralApp.ApplicationKey.ToString(); NewRowGeneralApp.GenApplicantType = "Participant"; NewRowShortTermApp.PartnerKey = NewRowGeneralApp.PartnerKey; NewRowShortTermApp.ApplicationKey = NewRowGeneralApp.ApplicationKey; NewRowShortTermApp.RegistrationOffice = NewRowGeneralApp.RegistrationOffice; NewRowShortTermApp.StAppDate = NewRowGeneralApp.GenAppDate; //TODO temp, needs to be changed NewRowShortTermApp.StApplicationType = "A"; NewRowShortTermApp.StBasicOutreachId = NewRowGeneralApp.OldLink; FMainDS.PmGeneralApplication.Rows.Add(NewRowGeneralApp); FMainDS.PmShortTermApplication.Rows.Add(NewRowShortTermApp); FPetraUtilsObject.SetChangedFlag(); grdDetails.DataSource = null; grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.PmGeneralApplication.DefaultView); SelectDetailRowByDataTableIndex(FMainDS.PmGeneralApplication.Rows.Count - 1); } }
/// <summary> /// add a new long term application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewRowLongTermApp(System.Object sender, EventArgs e) { // Clear any validation errors so that the following call to ValidateAllData starts with a 'clean slate'. FPetraUtilsObject.VerificationResultCollection.Clear(); if (ValidateAllData(true, true)) { // we create the table locally, no dataset IndividualDataTDSPmGeneralApplicationRow NewRowGeneralApp = FMainDS.PmGeneralApplication.NewRowTyped(true); PmYearProgramApplicationRow NewRowLongTermApp = FMainDS.PmYearProgramApplication.NewRowTyped(true); NewRowGeneralApp.PartnerKey = FMainDS.PPerson[0].PartnerKey; NewRowGeneralApp.ApplicationKey = GetNextApplicationKey(); NewRowGeneralApp.RegistrationOffice = Convert.ToInt64(TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY, "")); NewRowGeneralApp.GenAppDate = DateTime.Today; NewRowGeneralApp.ApplicationForEventOrField = Catalog.GetString("Field"); //TODO temp, needs to be changed NewRowGeneralApp.AppTypeName = "FIELD"; NewRowGeneralApp.OldLink = TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY, "") + ";" + NewRowGeneralApp.ApplicationKey.ToString();; NewRowGeneralApp.GenApplicantType = "Participant"; NewRowLongTermApp.PartnerKey = NewRowGeneralApp.PartnerKey; NewRowLongTermApp.ApplicationKey = NewRowGeneralApp.ApplicationKey; NewRowLongTermApp.RegistrationOffice = NewRowGeneralApp.RegistrationOffice; //TODO temp, needs to be changed NewRowLongTermApp.YpAppDate = NewRowGeneralApp.GenAppDate; NewRowLongTermApp.YpBasicAppType = "Field"; FMainDS.PmGeneralApplication.Rows.Add(NewRowGeneralApp); FMainDS.PmYearProgramApplication.Rows.Add(NewRowLongTermApp); FPetraUtilsObject.SetChangedFlag(); grdDetails.DataSource = null; grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.PmGeneralApplication.DefaultView); SelectDetailRowByDataTableIndex(FMainDS.PmGeneralApplication.Rows.Count - 1); } }
private void InitializeManualCode() { FTaxGovIdLabel = TSystemDefaults.GetStringDefault(SharedConstants.SYSDEFAULT_GOVID_LABEL, string.Empty); FTaxGovIdKeyName = TSystemDefaults.GetStringDefault(SharedConstants.SYSDEFAULT_GOVID_DB_KEY_NAME, string.Empty); if (FTaxGovIdLabel != string.Empty) { this.Text = string.Format("{0} ({1})", this.Text, FTaxGovIdLabel); } nudPartnerKeyColumn.Minimum = 1; nudPartnerKeyColumn.Maximum = 25; nudPartnerKeyColumn.Increment = 1; nudTaxCodeColumn.Minimum = 1; nudTaxCodeColumn.Maximum = 25; nudTaxCodeColumn.Increment = 1; }
// This function is necessary because there seemed to be no way to get the DataSet back from GetReportDataSet(). // I tested the obvious (explicit refs didn't work either): // DataSet ReportDataSet = null; // Thread t = new Thread(() => { ReportDataSet = TRemote.MReporting.WebConnectors.GetReportDataSet("DonorGiftStatement", paramsDictionary); }); // but ReportDataSet was null afterwards, even if I did a Thread.Join or while (!ThreadFinished){Thread.Sleep(50);} private void GetDGSDataSet(ref DataSet Results, Dictionary <String, TVariant> AParameters, ref Boolean ThreadFinished, TRptCalculator ACalc) { Results = TRemote.MReporting.WebConnectors.GetReportDataSet("DonorGiftStatement", AParameters); if ((Results != null) && (Results.Tables["Donors"] != null) && (Results.Tables["Donors"].Rows.Count != 0)) { // Moved this lot in here from LoadReportData() and added AWaitForThreadComplete so that we can keep the progress bar open during this step, which in // testing on a large report (~2000 pages) was rather substantial (10-15 seconds) which might lead the user to think it had hung. Boolean useGovId = TSystemDefaults.GetBooleanDefault("GovIdEnabled", false); ACalc.AddParameter("param_use_gov_id", useGovId); // Register datatables with the report FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["Donors"], "Donors"); FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["PartnersAddresses"], "DonorAddresses"); FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["Recipients"], "Recipients"); FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["Totals"], "Totals"); FPetraUtilsObject.FFastReportsPlugin.RegisterData(Results.Tables["TaxRef"], "TaxRef"); } ThreadFinished = true; }
private void InitializeManualCode() { const string APPLICATION_TITLE = "OpenPetra.org "; // Currently, only the Main Menu gets an 'OpenPetra styled' StatusBar (an 'OpenPetra styled' StatusBar // doesn't go with normal Forms at the moment as pnlContent's BackColor [and UserControls] is white // in colour and that doesn't look that good with an 'OpenPetra styled' StatusBar at the bottom). stbMain.UseOpenPetraToolStripRenderer = true; // this is needed for one screen which should only be displayed if tax deductibility is enabled FTaxDeductiblePercentageEnabled = Convert.ToBoolean( TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, "FALSE")); InitialiseTopPanel(); LoadNavigationUI(); this.Text = APPLICATION_TITLE + TApplicationVersion.GetApplicationVersion(); this.KeyDown += CustomKeyDownHandler; }
private PPartnerRow RetrieveDonorRow(long APartnerKey) { if (APartnerKey == 0) { return(null); } // find PPartnerRow from dataset PPartnerRow DonorRow = (PPartnerRow)FMainDS.DonorPartners.Rows.Find(new object[] { APartnerKey }); // if PPartnerRow cannot be found, load it from db if ((DonorRow == null) || (DonorRow[PPartnerTable.GetReceiptEachGiftDBName()] == DBNull.Value)) { PPartnerTable PartnerTable = TRemote.MFinance.Gift.WebConnectors.LoadPartnerData(APartnerKey); if ((PartnerTable == null) || (PartnerTable.Rows.Count == 0)) { // invalid partner return(null); } else { FMainDS.DonorPartners.Merge(PartnerTable); if (TSystemDefaults.GetBooleanDefault("GovIdEnabled", false)) { PTaxTable taxTbl = TRemote.MFinance.Gift.WebConnectors.LoadPartnerPtax(APartnerKey); if ((taxTbl != null) && (taxTbl.Rows.Count > 0)) { FMainDS.PTax.Merge(taxTbl); } } } DonorRow = PartnerTable[0]; } return(DonorRow); }
/// <summary> /// todoComment /// </summary> /// <param name="ALabelText"></param> /// <param name="AName"></param> public static void GetLocStrCounty(out String ALabelText, out String AName) { String LocalisedCountyLabel; LocalisedCountyLabel = TSystemDefaults.GetStringDefault(SharedConstants.SYSDEFAULT_LOCALISEDCOUNTYLABEL); if (LocalisedCountyLabel.Trim() != String.Empty) { if (!LocalisedCountyLabel.EndsWith(":")) { LocalisedCountyLabel = LocalisedCountyLabel + ':'; } ALabelText = LocalisedCountyLabel; } else { ALabelText = StrCountyDefaultLabel; } // Remove & and : from the LabelText to get the 'Name' of the field AName = ALabelText.Replace("&", ""); AName = AName.Replace(":", ""); }
public static bool GiftRevertAdjust(Hashtable requestParams, out TVerificationResultCollection AMessages) { AMessages = new TVerificationResultCollection(); Int32 ALedgerNumber = (Int32)requestParams["ALedgerNumber"]; Boolean batchSelected = (Boolean)requestParams["NewBatchSelected"]; Int32 ANewBatchNumber = 0; bool TaxDeductiblePercentageEnabled = Convert.ToBoolean( TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, "FALSE")); if (batchSelected) { ANewBatchNumber = (Int32)requestParams["NewBatchNumber"]; } String Function = (String)requestParams["Function"]; Int32 AGiftDetailNumber = (Int32)requestParams["GiftDetailNumber"]; Int32 AGiftNumber = (Int32)requestParams["GiftNumber"]; Int32 ABatchNumber = (Int32)requestParams["BatchNumber"]; //decimal batchHashTotal = 0; decimal batchGiftTotal = 0; GiftBatchTDS MainDS = new GiftBatchTDS(); TDBTransaction Transaction = null; DateTime ADateEffective; Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.Serializable); try { ALedgerTable LedgerTable = ALedgerAccess.LoadByPrimaryKey(ALedgerNumber, Transaction); AGiftBatchRow giftBatch; if (!batchSelected) { ADateEffective = (DateTime)requestParams["GlEffectiveDate"]; AGiftBatchAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, ABatchNumber, Transaction); AGiftBatchRow oldGiftBatch = MainDS.AGiftBatch[0]; TGiftBatchFunctions.CreateANewGiftBatchRow(ref MainDS, ref Transaction, ref LedgerTable, ALedgerNumber, ADateEffective); giftBatch = MainDS.AGiftBatch[1]; giftBatch.BankAccountCode = oldGiftBatch.BankAccountCode; giftBatch.BankCostCentre = oldGiftBatch.BankCostCentre; giftBatch.CurrencyCode = oldGiftBatch.CurrencyCode; giftBatch.ExchangeRateToBase = oldGiftBatch.ExchangeRateToBase; giftBatch.MethodOfPaymentCode = oldGiftBatch.MethodOfPaymentCode; giftBatch.HashTotal = 0; if (giftBatch.MethodOfPaymentCode.Length == 0) { giftBatch.SetMethodOfPaymentCodeNull(); } giftBatch.BankCostCentre = oldGiftBatch.BankCostCentre; giftBatch.GiftType = oldGiftBatch.GiftType; if (Function.Equals("AdjustGift")) { giftBatch.BatchDescription = Catalog.GetString("Gift Adjustment"); } else { giftBatch.BatchDescription = Catalog.GetString("Reverse Gift"); } } else { AGiftBatchAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, ANewBatchNumber, Transaction); giftBatch = MainDS.AGiftBatch[0]; ADateEffective = giftBatch.GlEffectiveDate; //If into an existing batch, then retrive the existing batch total batchGiftTotal = giftBatch.BatchTotal; } if (Function.Equals("ReverseGiftBatch")) { AGiftAccess.LoadViaAGiftBatch(MainDS, ALedgerNumber, ABatchNumber, Transaction); foreach (AGiftRow gift in MainDS.AGift.Rows) { AGiftDetailAccess.LoadViaAGift(MainDS, ALedgerNumber, ABatchNumber, gift.GiftTransactionNumber, Transaction); } } else { AGiftAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, ABatchNumber, AGiftNumber, Transaction); if (Function.Equals("ReverseGiftDetail")) { AGiftDetailAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, ABatchNumber, AGiftNumber, AGiftDetailNumber, Transaction); } else { AGiftDetailAccess.LoadViaAGift(MainDS, ALedgerNumber, ABatchNumber, AGiftNumber, Transaction); } } //assuming new elements are added after these static borders int cycle = 0; MainDS.AGift.DefaultView.Sort = string.Format("{0}, {1}", AGiftTable.GetBatchNumberDBName(), AGiftTable.GetGiftTransactionNumberDBName()); MainDS.AGiftDetail.DefaultView.Sort = string.Format("{0}, {1}, {2}", AGiftDetailTable.GetBatchNumberDBName(), AGiftDetailTable.GetGiftTransactionNumberDBName(), AGiftDetailTable.GetDetailNumberDBName()); do { foreach (DataRowView giftRow in MainDS.AGift.DefaultView) { AGiftRow oldGift = (AGiftRow)giftRow.Row; if ((oldGift.BatchNumber == ABatchNumber) && (oldGift.LedgerNumber == ALedgerNumber) && (Function.Equals("ReverseGiftBatch") || (oldGift.GiftTransactionNumber == AGiftNumber))) { AGiftRow gift = MainDS.AGift.NewRowTyped(true); DataUtilities.CopyAllColumnValuesWithoutPK(oldGift, gift); gift.LedgerNumber = giftBatch.LedgerNumber; gift.BatchNumber = giftBatch.BatchNumber; gift.DateEntered = ADateEffective; gift.GiftTransactionNumber = giftBatch.LastGiftNumber + 1; giftBatch.LastGiftNumber++; gift.LastDetailNumber = 0; MainDS.AGift.Rows.Add(gift); foreach (DataRowView giftDetailRow in MainDS.AGiftDetail.DefaultView) { AGiftDetailRow oldGiftDetail = (AGiftDetailRow)giftDetailRow.Row; if ((oldGiftDetail.GiftTransactionNumber == oldGift.GiftTransactionNumber) && (oldGiftDetail.BatchNumber == ABatchNumber) && (oldGiftDetail.LedgerNumber == ALedgerNumber) && (!Function.Equals("ReverseGiftDetail") || (oldGiftDetail.DetailNumber == AGiftDetailNumber))) { if ((cycle == 0) && oldGiftDetail.ModifiedDetail) { AMessages.Add(new TVerificationResult( String.Format(Catalog.GetString("Cannot reverse or adjust Gift {0} with Detail {1} in Batch {2}"), oldGiftDetail.GiftTransactionNumber, oldGiftDetail.DetailNumber, oldGiftDetail.BatchNumber), String.Format(Catalog.GetString("It was already adjusted or reversed.")), TResultSeverity.Resv_Critical)); DBAccess.GDBAccessObj.RollbackTransaction(); return(false); } AGiftDetailRow giftDetail = MainDS.AGiftDetail.NewRowTyped(true); DataUtilities.CopyAllColumnValuesWithoutPK(oldGiftDetail, giftDetail); giftDetail.DetailNumber = ++gift.LastDetailNumber; giftDetail.LedgerNumber = gift.LedgerNumber; giftDetail.BatchNumber = giftBatch.BatchNumber; giftDetail.GiftTransactionNumber = gift.GiftTransactionNumber; //Identify the reversal source giftDetail.ModifiedDetailKey = "|" + oldGiftDetail.BatchNumber.ToString() + "|" + oldGiftDetail.GiftTransactionNumber.ToString() + "|" + oldGiftDetail.DetailNumber.ToString(); decimal signum = (cycle == 0) ? -1 : 1; giftDetail.GiftTransactionAmount = signum * oldGiftDetail.GiftTransactionAmount; batchGiftTotal += giftDetail.GiftTransactionAmount; giftDetail.GiftAmount = signum * oldGiftDetail.GiftAmount; giftDetail.GiftAmountIntl = signum * oldGiftDetail.GiftAmountIntl; if (TaxDeductiblePercentageEnabled) { giftDetail.TaxDeductibleAmount = signum * oldGiftDetail.TaxDeductibleAmount; giftDetail.TaxDeductibleAmountBase = signum * oldGiftDetail.TaxDeductibleAmountBase; giftDetail.TaxDeductibleAmountIntl = signum * oldGiftDetail.TaxDeductibleAmountIntl; giftDetail.NonDeductibleAmount = signum * oldGiftDetail.NonDeductibleAmount; giftDetail.NonDeductibleAmountBase = signum * oldGiftDetail.NonDeductibleAmountBase; giftDetail.NonDeductibleAmountIntl = signum * oldGiftDetail.NonDeductibleAmountIntl; } giftDetail.GiftCommentOne = (String)requestParams["ReversalCommentOne"]; giftDetail.GiftCommentTwo = (String)requestParams["ReversalCommentTwo"]; giftDetail.GiftCommentThree = (String)requestParams["ReversalCommentThree"]; giftDetail.CommentOneType = (String)requestParams["ReversalCommentOneType"]; giftDetail.CommentTwoType = (String)requestParams["ReversalCommentTwoType"]; giftDetail.CommentThreeType = (String)requestParams["ReversalCommentThreeType"]; // This is used to mark both as a Reverted giftDetails, except the adjusted (new) gift giftDetail.ModifiedDetail = (cycle == 0); oldGiftDetail.ModifiedDetail = (cycle == 0); MainDS.AGiftDetail.Rows.Add(giftDetail); } } } } cycle++; } while ((cycle < 2) && Function.Equals("AdjustGift")); //When reversing into a new or existing batch, set batch total if (!Function.Equals("AdjustGift")) { giftBatch.BatchTotal = batchGiftTotal; } // save everything at the end AGiftBatchAccess.SubmitChanges(MainDS.AGiftBatch, Transaction); ALedgerAccess.SubmitChanges(LedgerTable, Transaction); AGiftAccess.SubmitChanges(MainDS.AGift, Transaction); AGiftDetailAccess.SubmitChanges(MainDS.AGiftDetail, Transaction); MainDS.AGiftBatch.AcceptChanges(); DBAccess.GDBAccessObj.CommitTransaction(); return(true); } catch (Exception Exc) { TLogging.Log("An Exception occured while performing Gift Reverse/Adjust:" + Environment.NewLine + Exc.ToString()); DBAccess.GDBAccessObj.RollbackTransaction(); throw new EOPAppException(Catalog.GetString("Gift Reverse/Adjust failed."), Exc); } }
} // Total Gifts Through Field Month /// <summary> /// Find all the gifts for a year, returning "worker", "field" and "total" results. /// </summary> public static DataTable TotalGiftsThroughFieldYear(TParameterList AParameters, TResultList AResults) { bool TaxDeductiblePercentageEnabled = TSystemDefaults.GetBooleanDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false); Int32 LedgerNum = AParameters.Get("param_ledger_number_i").ToInt32(); Int32 NumberOfYears = AParameters.Get("param_NumberOfYears").ToInt32(); string SqlQuery = "SELECT batch.a_gl_effective_date_d as Date, motive.a_report_column_c AS ReportColumn, "; if (AParameters.Get("param_currency").ToString() == "Base") { SqlQuery += "detail.a_gift_amount_n AS Amount"; if (TaxDeductiblePercentageEnabled) { SqlQuery += ", detail.a_tax_deductible_amount_base_n AS TaxDeductAmount"; } } else { SqlQuery += "detail.a_gift_amount_intl_n AS Amount"; if (TaxDeductiblePercentageEnabled) { SqlQuery += ", detail.a_tax_deductible_amount_intl_n AS TaxDeductAmount"; } } SqlQuery += (" FROM PUB_a_gift as gift, PUB_a_gift_detail as detail, PUB_a_gift_batch as batch, PUB_a_motivation_detail AS motive" + " WHERE detail.a_ledger_number_i = " + LedgerNum + " AND batch.a_batch_status_c = 'Posted'" + " AND batch.a_batch_number_i = gift.a_batch_number_i" + " AND batch.a_ledger_number_i = " + LedgerNum + " AND gift.a_ledger_number_i = " + LedgerNum + " AND detail.a_batch_number_i = gift.a_batch_number_i" + " AND detail.a_gift_transaction_number_i = gift.a_gift_transaction_number_i" + " AND motive.a_ledger_number_i = " + LedgerNum + " AND motive.a_motivation_group_code_c = detail.a_motivation_group_code_c" + " AND motive.a_motivation_detail_code_c = detail.a_motivation_detail_code_c" + " AND motive.a_receipt_l=true"); DataTable tempTbl = null; TDBTransaction Transaction = null; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { tempTbl = DBAccess.GDBAccessObj.SelectDT(SqlQuery, "result", Transaction); }); DataTable resultTable = new DataTable(); resultTable.Columns.Add("SummaryYear", typeof(Int32)); // resultTable.Columns.Add("YearWorker", typeof(Decimal)); // These are the names of the variables resultTable.Columns.Add("YearWorkerCount", typeof(Int32)); // returned by this calculation. resultTable.Columns.Add("YearField", typeof(Decimal)); // resultTable.Columns.Add("YearFieldCount", typeof(Int32)); // resultTable.Columns.Add("YearTotal", typeof(Decimal)); // resultTable.Columns.Add("YearTotalCount", typeof(Int32)); // resultTable.Columns.Add("YearWorkerTaxDeduct", typeof(Decimal)); resultTable.Columns.Add("YearFieldTaxDeduct", typeof(Decimal)); resultTable.Columns.Add("YearTotalTaxDeduct", typeof(Decimal)); Int32 Year = DateTime.Now.Year; for (Int32 YearIdx = 0; YearIdx < NumberOfYears; YearIdx++) { //TODO: Calendar vs Financial Date Handling - Check if financial year start/end should be used not calendar string yearStart = String.Format("#{0:0000}-01-01#", Year - YearIdx); string yearEnd = String.Format("#{0:0000}-12-31#", Year - YearIdx); tempTbl.DefaultView.RowFilter = "Date >= " + yearStart + " AND Date < " + yearEnd; Decimal WorkerTotal = 0; Decimal FieldTotal = 0; Int32 WorkerCount = 0; Int32 FieldCount = 0; Int32 TotalCount = tempTbl.DefaultView.Count; Decimal WorkerTotalTaxDeduct = 0; Decimal FieldTotalTaxDeduct = 0; for (int i = 0; i < TotalCount; i++) { DataRow Row = tempTbl.DefaultView[i].Row; if (Row["ReportColumn"].ToString() == "Worker") { WorkerCount++; WorkerTotal += Convert.ToDecimal(Row["Amount"]); if (TaxDeductiblePercentageEnabled) { WorkerTotalTaxDeduct += Convert.ToDecimal(Row["TaxDeductAmount"]); } } else { FieldCount++; FieldTotal += Convert.ToDecimal(Row["Amount"]); if (TaxDeductiblePercentageEnabled) { FieldTotalTaxDeduct += Convert.ToDecimal(Row["TaxDeductAmount"]); } } } DataRow resultRow = resultTable.NewRow(); resultRow["SummaryYear"] = Year - YearIdx; resultRow["YearWorker"] = WorkerTotal; resultRow["YearWorkerCount"] = WorkerCount; resultRow["YearField"] = FieldTotal; resultRow["YearFieldCount"] = FieldCount; resultRow["YearTotal"] = WorkerTotal + FieldTotal; resultRow["YearTotalCount"] = TotalCount; resultRow["YearWorkerTaxDeduct"] = WorkerTotalTaxDeduct; resultRow["YearFieldTaxDeduct"] = FieldTotalTaxDeduct; resultRow["YearTotalTaxDeduct"] = WorkerTotalTaxDeduct + FieldTotalTaxDeduct; resultTable.Rows.Add(resultRow); } return(resultTable); }
private void BtnOK_Click(Object Sender, EventArgs e) { if (txtDonationDays.NumberValueInt.HasValue) { FGiftDays = txtDonationDays.NumberValueInt.Value; } FExtra = txtOptionalMetadata.Text; Boolean OkToClose = true; if (txtReplyToEmail.Text != "") { FReplyToEmail = txtReplyToEmail.Text; TUserDefaults.SetDefault("ReplyToEmail", FReplyToEmail); } if (txtServerEmailAddress.Text != "") { FServerAddress = txtServerEmailAddress.Text; TUserDefaults.SetDefault("IntranetServerAddress", FServerAddress); } if (txtOldPassword.Text != "") { string PswdError = ""; if (txtOldPassword.Text == FPswd) { if (txtNewPassword.Text != "") { if (txtNewPassword.Text == txtConfirmPassword.Text) { FPswd = txtNewPassword.Text; } else { PswdError = Catalog.GetString("Password error - new passwords don't match."); } } else { PswdError = Catalog.GetString("Password error - password cannot be empty."); } } else { PswdError = Catalog.GetString("Password error - old password incorrect."); } if (PswdError == "") { MessageBox.Show(Catalog.GetString("New password accepted."), Catalog.GetString("Password Change")); } else { MessageBox.Show(PswdError, Catalog.GetString("Password Change"), MessageBoxButtons.OK, MessageBoxIcon.Hand); OkToClose = false; } } if (OkToClose) { TSystemDefaults.SetSystemDefault("IntranetExportSettings", String.Format("{0},{1},{2}", FPswd, FGiftDays, FExtra)); Close(); } }
private static void CreateShortTermApplication(XmlNode ANode, Int64 APartnerKey, ref PartnerImportExportTDS AMainDS, TDBTransaction ATransaction) { String strEventKey = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_EVENTKEY); long EventKey = -1; if (strEventKey.Length > 0) { try { EventKey = long.Parse(strEventKey); } catch (System.FormatException) { AddVerificationResult("Bad number format in EventKey: " + strEventKey); } if (!PUnitAccess.Exists(EventKey, ATransaction)) { AddVerificationResult("EventKey not known - application cannot be imported: " + EventKey); return; } PmGeneralApplicationRow GenAppRow = AMainDS.PmGeneralApplication.NewRowTyped(); GenAppRow.PartnerKey = APartnerKey; GenAppRow.ApplicationKey = (int)DBAccess.GDBAccessObj.GetNextSequenceValue("seq_application", ATransaction); GenAppRow.OldLink = TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY, "") + ";" + GenAppRow.ApplicationKey.ToString(); GenAppRow.RegistrationOffice = DomainManager.GSiteKey; // When this is imported, RegistrationOffice can't be null. GenAppRow.GenAppDate = DateTime.Now; GenAppRow.AppTypeName = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_APPTYPE); GenAppRow.GenApplicationStatus = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_APPSTATUS); GenAppRow.Comment = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_APPCOMMENTS); PmShortTermApplicationRow ShortTermRow = AMainDS.PmShortTermApplication.NewRowTyped(); ShortTermRow.PartnerKey = APartnerKey; ShortTermRow.ApplicationKey = GenAppRow.ApplicationKey; ShortTermRow.RegistrationOffice = GenAppRow.RegistrationOffice; // When this is imported, RegistrationOffice can't be null. ShortTermRow.StBasicOutreachId = "Unused field"; // This field is scheduled for deletion, but NOT NULL now. ShortTermRow.StAppDate = DateTime.Now; ShortTermRow.StApplicationType = GenAppRow.AppTypeName; ShortTermRow.StConfirmedOption = EventKey; String TimeString = ""; try { TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ARRIVALDATE); if (TimeString.Length > 0) { ShortTermRow.Arrival = DateTime.Parse(TimeString); } TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_DEPARTUREDATE); if (TimeString.Length > 0) { ShortTermRow.Departure = DateTime.Parse(TimeString); } } catch (System.FormatException) { AddVerificationResult("Bad date format in Application: " + TimeString); } DateTime TempTime; TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ARRIVALTIME); if (TimeString.Length > 0) { try { TempTime = DateTime.Parse(TimeString); ShortTermRow.ArrivalHour = TempTime.Hour; ShortTermRow.ArrivalMinute = TempTime.Minute; } catch (System.FormatException) { AddVerificationResult("Bad time format in Application: " + TimeString); } } TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_DEPARTURETIME); if (TimeString.Length > 0) { try { TempTime = DateTime.Parse(TimeString); ShortTermRow.DepartureHour = TempTime.Hour; ShortTermRow.DepartureMinute = TempTime.Minute; } catch (System.FormatException) { AddVerificationResult("Bad time format in Application: " + TimeString); } } ShortTermRow.OutreachRole = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_EVENTROLE); String ChargedField = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_CHARGEDFIELD); if (ChargedField.Length > 0) { try { ShortTermRow.StFieldCharged = long.Parse(ChargedField); } catch { AddVerificationResult("Bad number format in ChargedField: " + ChargedField); } } AMainDS.PmGeneralApplication.Rows.Add(GenAppRow); AMainDS.PmShortTermApplication.Rows.Add(ShortTermRow); AddVerificationResult("Application Record Created.", TResultSeverity.Resv_Status); } }
/// <summary> /// Find all the gifts for a specific month, returning "worker", "field" and "total" results. /// </summary> public static DataTable TotalGiftsThroughFieldMonth(TParameterList AParameters, TResultList AResults) { Int32 LedgerNum = AParameters.Get("param_ledger_number_i").ToInt32(); Int32 Year = AParameters.Get("param_YearBlock").ToInt32(); string YearStart = String.Format("#{0:0000}-01-01#", Year); string YearEnd = String.Format("#{0:0000}-12-31#", Year); bool TaxDeductiblePercentageEnabled = Convert.ToBoolean( TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, "FALSE")); string SqlQuery = "SELECT batch.a_gl_effective_date_d as Date, motive.a_report_column_c AS ReportColumn, "; if (AParameters.Get("param_currency").ToString() == "Base") { SqlQuery += "detail.a_gift_amount_n AS Amount"; if (TaxDeductiblePercentageEnabled) { SqlQuery += ", detail.a_tax_deductible_amount_base_n AS TaxDeductAmount"; } } else { SqlQuery += "detail.a_gift_amount_intl_n AS Amount"; if (TaxDeductiblePercentageEnabled) { SqlQuery += ", detail.a_tax_deductible_amount_intl_n AS TaxDeductAmount"; } } SqlQuery += (" FROM PUB_a_gift as gift, PUB_a_gift_detail as detail, PUB_a_gift_batch as batch, PUB_a_motivation_detail AS motive" + " WHERE detail.a_ledger_number_i = " + LedgerNum + " AND batch.a_batch_status_c = 'Posted'" + " AND batch.a_batch_number_i = gift.a_batch_number_i" + " AND batch.a_ledger_number_i = " + LedgerNum + " AND batch.a_gl_effective_date_d >= " + YearStart + " AND batch.a_gl_effective_date_d <= " + YearEnd + " AND gift.a_ledger_number_i = " + LedgerNum + " AND detail.a_batch_number_i = gift.a_batch_number_i" + " AND detail.a_gift_transaction_number_i = gift.a_gift_transaction_number_i" + " AND motive.a_ledger_number_i = " + LedgerNum + " AND motive.a_motivation_group_code_c = detail.a_motivation_group_code_c" + " AND motive.a_motivation_detail_code_c = detail.a_motivation_detail_code_c" + " AND motive.a_receipt_l=true"); Boolean newTransaction; TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, out newTransaction); DataTable tempTbl = DBAccess.GDBAccessObj.SelectDT(SqlQuery, "result", Transaction); if (newTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } DataTable resultTable = new DataTable(); resultTable.Columns.Add("MonthName", typeof(String)); // resultTable.Columns.Add("MonthWorker", typeof(Decimal)); // These are the names of the variables resultTable.Columns.Add("MonthWorkerCount", typeof(Int32)); // returned by this calculation. resultTable.Columns.Add("MonthField", typeof(Decimal)); // resultTable.Columns.Add("MonthFieldCount", typeof(Int32)); // resultTable.Columns.Add("MonthTotal", typeof(Decimal)); // resultTable.Columns.Add("MonthTotalCount", typeof(Int32)); // resultTable.Columns.Add("MonthWorkerTaxDeduct", typeof(Decimal)); resultTable.Columns.Add("MonthFieldTaxDeduct", typeof(Decimal)); resultTable.Columns.Add("MonthTotalTaxDeduct", typeof(Decimal)); for (int mnth = 1; mnth <= 12; mnth++) { string monthStart = String.Format("#{0:0000}-{1:00}-01#", Year, mnth); string nextMonthStart = String.Format("#{0:0000}-{1:00}-01#", Year, mnth + 1); if (mnth == 12) { nextMonthStart = String.Format("#{0:0000}-01-01#", Year + 1); } tempTbl.DefaultView.RowFilter = "Date >= " + monthStart + " AND Date < " + nextMonthStart; Decimal WorkerTotal = 0; Decimal FieldTotal = 0; Int32 WorkerCount = 0; Int32 FieldCount = 0; Int32 TotalCount = tempTbl.DefaultView.Count; Decimal WorkerTotalTaxDeduct = 0; Decimal FieldTotalTaxDeduct = 0; for (int i = 0; i < TotalCount; i++) { DataRow Row = tempTbl.DefaultView[i].Row; if (Row["ReportColumn"].ToString() == "Worker") { WorkerCount++; WorkerTotal += Convert.ToDecimal(Row["Amount"]); if (TaxDeductiblePercentageEnabled) { WorkerTotalTaxDeduct += Convert.ToDecimal(Row["TaxDeductAmount"]); } } else { FieldCount++; FieldTotal += Convert.ToDecimal(Row["Amount"]); if (TaxDeductiblePercentageEnabled) { FieldTotalTaxDeduct += Convert.ToDecimal(Row["TaxDeductAmount"]); } } } DataRow resultRow = resultTable.NewRow(); resultRow["MonthName"] = StringHelper.GetLongMonthName(mnth); resultRow["MonthWorker"] = WorkerTotal; resultRow["MonthWorkerCount"] = WorkerCount; resultRow["MonthField"] = FieldTotal; resultRow["MonthFieldCount"] = FieldCount; resultRow["MonthTotal"] = WorkerTotal + FieldTotal; resultRow["MonthTotalCount"] = TotalCount; resultRow["MonthWorkerTaxDeduct"] = WorkerTotalTaxDeduct; resultRow["MonthFieldTaxDeduct"] = FieldTotalTaxDeduct; resultRow["MonthTotalTaxDeduct"] = WorkerTotalTaxDeduct + FieldTotalTaxDeduct; resultTable.Rows.Add(resultRow); } return(resultTable); }
/// <summary> /// save the changes /// </summary> /// <returns></returns> public bool SaveChanges() { Boolean Result = false; String CheckedStringList = clbSites.GetCheckedStringList(); String[] SiteKeyArray = CheckedStringList.Split(','); Int32 Counter = 0; List <Int64> AddedSiteKeyList = new List <Int64>(); List <Int64> RemovedSiteKeyList = new List <Int64>(); Int64 RemovedSiteKey; String RemovedSiteName; Boolean AnySiteRemoved = false; String UserMessage = Catalog.GetString( "Are you sure you want to remove access to following sites? You will not be able to create Partner Keys for them any longer! \r\n"); TVerificationResultCollection VerificationResultCollection = new TVerificationResultCollection(); TVerificationResult VerificationResult = TStringChecks.StringMustNotBeEmpty(cmbDefaultSite.Text, lblDefaultSite.Text); // Handle addition/removal to/from TVerificationResultCollection VerificationResultCollection.Auto_Add_Or_AddOrRemove(null, VerificationResult, null); if (!TDataValidation.ProcessAnyDataValidationErrors(false, VerificationResultCollection, this.GetType())) { return(false); } // save site keys selected for possible use for (Counter = 0; Counter < SiteKeyArray.Length; Counter++) { AddedSiteKeyList.Add(Convert.ToInt64(SiteKeyArray[Counter])); } // create list of site keys that have been removed and double check with user foreach (DataRow SiteRow in AvailableSitesTable.Rows) { if (!Convert.ToBoolean(SiteRow[SharedConstants.SYSMAN_AVAILABLE_SITES_COLUMN_IS_PARTNER_LEDGER])) { // check if previously checked site is now no longer checked RemovedSiteKey = Convert.ToInt64(SiteRow[PUnitTable.GetPartnerKeyDBName()]); if (OriginallyCheckedSites.Contains(RemovedSiteKey)) { AnySiteRemoved = true; RemovedSiteKeyList.Add(RemovedSiteKey); RemovedSiteName = SiteRow[PUnitTable.GetUnitNameDBName()].ToString(); UserMessage += "\r\n" + String.Format("{0:0000000000}", RemovedSiteKey) + " - " + RemovedSiteName; } } } if (AnySiteRemoved) { if (MessageBox.Show(UserMessage, Catalog.GetString("Remove access to Sites"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return(false); } } // save default site key if (cmbDefaultSite.SelectedValue != null) { TSystemDefaults.SetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY, cmbDefaultSite.SelectedValue.ToString()); } Result = TRemote.MSysMan.WebConnectors.SaveSiteKeys(AddedSiteKeyList, RemovedSiteKeyList); if (Result) { // reload data from server here so the list is sorted by check box value first and then site name (consider doing this // on client in the future if performance issues) LoadSitesData(); FPetraUtilsObject.DisableSaveButton(); // We don't have unsaved changes anymore FPetraUtilsObject.HasChanges = false; } return(Result); }
/// <summary> /// Adds a duplicate Gift Detail (or reversed duplicate GiftDetail) to Gift. /// </summary> /// <param name="AMainDS"></param> /// <param name="AGift"></param> /// <param name="AOldGiftDetail"></param> /// <param name="AReversal">True for reverse or false for straight duplicate</param> /// <param name="ATransaction"></param> /// <param name="AFunction"></param> /// <param name="ANewPct"></param> /// <param name="AAutoCompleteComments"></param> /// <param name="AReversalCommentOne"></param> /// <param name="AReversalCommentTwo"></param> /// <param name="AReversalCommentThree"></param> /// <param name="AReversalCommentOneType"></param> /// <param name="AReversalCommentTwoType"></param> /// <param name="AReversalCommentThreeType"></param> /// <param name="AUpdateTaxDeductiblePctRecipients"></param> /// <param name="AGeneralFixedGiftDestination"></param> /// <param name="AFixedGiftDestination"></param> private static void AddDuplicateGiftDetailToGift(ref GiftBatchTDS AMainDS, ref AGiftRow AGift, AGiftDetailRow AOldGiftDetail, bool AReversal, TDBTransaction ATransaction, GiftAdjustmentFunctionEnum AFunction, Decimal ANewPct, bool AAutoCompleteComments = false, string AReversalCommentOne = "", string AReversalCommentTwo = "", string AReversalCommentThree = "", string AReversalCommentOneType = "", string AReversalCommentTwoType = "", string AReversalCommentThreeType = "", List <string[]> AUpdateTaxDeductiblePctRecipients = null, bool AGeneralFixedGiftDestination = false, List <string> AFixedGiftDestination = null ) { bool TaxDeductiblePercentageEnabled = new TSystemDefaults(ATransaction.DataBaseObj).GetBooleanDefault(SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false); AGiftDetailRow giftDetail = AMainDS.AGiftDetail.NewRowTyped(true); DataUtilities.CopyAllColumnValuesWithoutPK(AOldGiftDetail, giftDetail); giftDetail.DetailNumber = AGift.LastDetailNumber + 1; AGift.LastDetailNumber++; giftDetail.LedgerNumber = AGift.LedgerNumber; giftDetail.BatchNumber = AGift.BatchNumber; giftDetail.GiftTransactionNumber = AGift.GiftTransactionNumber; giftDetail.IchNumber = 0; decimal signum = (AReversal) ? -1 : 1; giftDetail.GiftTransactionAmount = signum * AOldGiftDetail.GiftTransactionAmount; giftDetail.GiftAmount = signum * AOldGiftDetail.GiftAmount; giftDetail.GiftAmountIntl = signum * AOldGiftDetail.GiftAmountIntl; if (TaxDeductiblePercentageEnabled) { if (!AReversal && AFunction.Equals(GiftAdjustmentFunctionEnum.TaxDeductiblePctAdjust)) { giftDetail.TaxDeductiblePct = ANewPct; TaxDeductibility.UpdateTaxDeductibiltyAmounts(ref giftDetail); } else if (!AReversal) { if (AUpdateTaxDeductiblePctRecipients != null) { string[] Result = AUpdateTaxDeductiblePctRecipients.Find(x => x[0] == giftDetail.RecipientKey.ToString()); // true if a new percentage is available and the user wants to use it if (Result != null) { giftDetail.TaxDeductiblePct = Convert.ToDecimal(Result[1]); TaxDeductibility.UpdateTaxDeductibiltyAmounts(ref giftDetail); } } } else { giftDetail.TaxDeductibleAmount = signum * AOldGiftDetail.TaxDeductibleAmount; giftDetail.TaxDeductibleAmountBase = signum * AOldGiftDetail.TaxDeductibleAmountBase; giftDetail.TaxDeductibleAmountIntl = signum * AOldGiftDetail.TaxDeductibleAmountIntl; giftDetail.NonDeductibleAmount = signum * AOldGiftDetail.NonDeductibleAmount; giftDetail.NonDeductibleAmountBase = signum * AOldGiftDetail.NonDeductibleAmountBase; giftDetail.NonDeductibleAmountIntl = signum * AOldGiftDetail.NonDeductibleAmountIntl; } } if (AAutoCompleteComments) // only used for tax deductible pct gift adjustments { AGiftRow OldGiftRow = (AGiftRow)AMainDS.AGift.Rows.Find( new object[] { AOldGiftDetail.LedgerNumber, AOldGiftDetail.BatchNumber, AOldGiftDetail.GiftTransactionNumber }); giftDetail.GiftCommentThree = Catalog.GetString("Original gift date: " + OldGiftRow.DateEntered.ToString("dd-MMM-yyyy")); giftDetail.CommentThreeType = "Both"; } else // user defined { giftDetail.GiftCommentOne = AReversalCommentOne; giftDetail.GiftCommentTwo = AReversalCommentTwo; giftDetail.GiftCommentThree = AReversalCommentThree; giftDetail.CommentOneType = AReversalCommentOneType; giftDetail.CommentTwoType = AReversalCommentTwoType; giftDetail.CommentThreeType = AReversalCommentThreeType; } // If reversal: mark the new gift as a reversal if (AReversal) { giftDetail.ModifiedDetail = true; //Identify the reversal source giftDetail.ModifiedDetailKey = "|" + AOldGiftDetail.BatchNumber.ToString() + "|" + AOldGiftDetail.GiftTransactionNumber.ToString() + "|" + AOldGiftDetail.DetailNumber.ToString(); } else { giftDetail.ModifiedDetail = false; // Make sure the motivation detail is still active. If not then we need a new one. AMotivationDetailTable MotivationDetailTable = AMotivationDetailAccess.LoadViaAMotivationGroup( giftDetail.LedgerNumber, giftDetail.MotivationGroupCode, ATransaction); DataRow CurrentMotivationDetail = MotivationDetailTable.Rows.Find( new object[] { giftDetail.LedgerNumber, giftDetail.MotivationGroupCode, giftDetail.MotivationDetailCode }); // Motivation detail has been made inactive (or doesn't exist) then use default if (!((MotivationDetailTable != null) && (MotivationDetailTable.Rows.Count > 0) && (CurrentMotivationDetail != null)) || !Convert.ToBoolean(CurrentMotivationDetail[AMotivationDetailTable.GetMotivationStatusDBName()])) { bool ActiveRowFound = false; // search for first alternative active detail that is part of the same group foreach (AMotivationDetailRow Row in MotivationDetailTable.Rows) { if ((Row.MotivationDetailCode != giftDetail.MotivationDetailCode) && Row.MotivationStatus) { ActiveRowFound = true; giftDetail.MotivationGroupCode = Row.MotivationGroupCode; giftDetail.MotivationDetailCode = Row.MotivationDetailCode; break; } } // if none found then use default group and detail if (!ActiveRowFound) { giftDetail.MotivationGroupCode = MFinanceConstants.MOTIVATION_GROUP_GIFT; giftDetail.MotivationDetailCode = MFinanceConstants.GROUP_DETAIL_SUPPORT; } } // if the gift destination should be fixed if ((AFunction.Equals(GiftAdjustmentFunctionEnum.TaxDeductiblePctAdjust) && AGeneralFixedGiftDestination) || ((AFixedGiftDestination != null) && (AFixedGiftDestination.Exists(x => x == giftDetail.RecipientKey.ToString())))) { giftDetail.FixedGiftDestination = true; } else { giftDetail.FixedGiftDestination = false; } } AMainDS.AGiftDetail.Rows.Add(giftDetail); }
public static DataTable GiftBatchDetailTable(Dictionary <String, TVariant> AParameters, TReportingDbAdapter DbAdapter) { TDBTransaction Transaction = null; int LedgerNumber = AParameters["param_ledger_number_i"].ToInt32(); int BatchNumber = AParameters["param_batch_number_i"].ToInt32(); // create new datatable DataTable Results = new DataTable(); DBAccess.GDBAccessObj.BeginAutoReadTransaction( ref Transaction, delegate { String CurrentDate = DateTime.Today.ToString( "yyyy-MM-dd"); string Query = "SELECT DISTINCT a_gift_batch.a_batch_description_c, a_gift_batch.a_batch_status_c, a_gift_batch.a_gift_type_c, a_gift_batch.a_gl_effective_date_d, " + "a_gift_batch.a_bank_cost_centre_c, a_gift_batch.a_bank_account_code_c, a_gift_batch.a_currency_code_c, a_gift_batch.a_hash_total_n, a_gift_batch.a_batch_total_n, " + "a_gift_detail.a_gift_transaction_number_i, a_gift_detail.a_detail_number_i, a_gift_detail.a_confidential_gift_flag_l, " + "a_gift_detail.p_recipient_key_n, a_gift_detail.a_gift_amount_n, a_gift_detail.a_gift_amount_intl_n, a_gift_detail.a_gift_transaction_amount_n, " + "a_gift_detail.a_motivation_group_code_c, a_gift_detail.a_motivation_detail_code_c, a_gift_detail.a_recipient_ledger_number_n, " + "a_gift_detail.a_gift_comment_one_c, a_gift_detail.a_gift_comment_two_c, a_gift_detail.a_gift_comment_three_c, a_gift_detail.a_tax_deductible_pct_n, " + "a_gift.p_donor_key_n AS DonorKey, a_gift.a_reference_c AS GiftReference, a_gift.a_method_of_giving_code_c, a_gift.a_method_of_payment_code_c, " + "a_gift.a_receipt_letter_code_c, a_gift.a_date_entered_d, a_gift.a_first_time_gift_l, a_gift.a_receipt_number_i, " + "Donor.p_partner_class_c AS DonorClass, Donor.p_partner_short_name_c AS DonorShortName, Donor.p_receipt_letter_frequency_c, Donor.p_receipt_each_gift_l, " + "Recipient.p_partner_class_c AS RecipientClass, Recipient.p_partner_short_name_c AS RecipientShortName, " + "a_gift_detail.p_mailing_code_c AS MailingCode, " + "a_gift_detail.a_charge_flag_l AS ChargeFlag, " + // true if donor has a valid Ex-Worker special type "CASE WHEN EXISTS (SELECT p_partner_type.* FROM p_partner_type WHERE " + "p_partner_type.p_partner_key_n = a_gift.p_donor_key_n" + " AND (p_partner_type.p_valid_from_d IS null OR p_partner_type.p_valid_from_d <= '" + CurrentDate + "')" + " AND (p_partner_type.p_valid_until_d IS null OR p_partner_type.p_valid_until_d >= '" + CurrentDate + "')" + " AND p_partner_type.p_type_code_c LIKE '" + TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_EXWORKERSPECIALTYPE, "EX-WORKER") + "%'" + ") THEN True ELSE False END AS EXWORKER, " + // true if the gift is restricted for the user "CASE WHEN EXISTS (SELECT s_user_group.* FROM s_user_group " + "WHERE a_gift.a_restricted_l IS true" + " AND NOT EXISTS (SELECT s_group_gift.s_read_access_l FROM s_group_gift, s_user_group " + "WHERE s_group_gift.s_read_access_l" + " AND s_group_gift.a_ledger_number_i = " + LedgerNumber + " AND s_group_gift.a_batch_number_i = " + BatchNumber + " AND s_group_gift.a_gift_transaction_number_i = a_gift_detail.a_gift_transaction_number_i" + " AND s_user_group.s_user_id_c = '" + UserInfo.GUserInfo.UserID + "'" + " AND s_user_group.s_group_id_c = s_group_gift.s_group_id_c" + " AND s_user_group.s_unit_key_n = s_group_gift.s_group_unit_key_n)" + ") THEN False ELSE True END AS ReadAccess " + "FROM a_gift_batch, a_gift_detail, a_gift, p_partner AS Donor, p_partner AS Recipient " + "WHERE a_gift_batch.a_ledger_number_i = " + LedgerNumber + " AND a_gift_batch.a_batch_number_i = " + BatchNumber + " AND a_gift.a_ledger_number_i = " + LedgerNumber + " AND a_gift.a_batch_number_i = " + BatchNumber + " AND a_gift_detail.a_ledger_number_i = " + LedgerNumber + " AND a_gift_detail.a_batch_number_i = " + BatchNumber + " AND a_gift.a_gift_transaction_number_i = a_gift_detail.a_gift_transaction_number_i " + " AND Donor.p_partner_key_n = a_gift.p_donor_key_n" + " AND Recipient.p_partner_key_n = a_gift_detail.p_recipient_key_n"; Results = DbAdapter.RunQuery(Query, "Results", Transaction); }); return(Results); }