private void DonorGiftStatement(object sender, EventArgs e) { TFrmDonorGiftStatement DonorGiftStatement = new TFrmDonorGiftStatement(this); DonorGiftStatement.LedgerNumber = FLedgerNumber; DonorGiftStatement.SetControls(GiftStatementParameters(DonorGiftStatement)); DonorGiftStatement.Show(); }
// parameters to be passed to Gift Statement screens private TParameterList GiftStatementParameters(TFrmDonorGiftStatement ADonor = null) { TParameterList ReturnValue = new TParameterList(); // if btnDonorGiftStatement was clicked if (ADonor != null) { ReturnValue.Add("param_donor", "One Donor"); ReturnValue.Add("param_donorkey", FDonorKey); TRptCalculator Calc = new TRptCalculator(); ADonor.ReadControls(Calc, TReportActionEnum.raLoad); ReturnValue.Add("param_min_amount", Calc.GetParameters().GetParameter("param_min_amount").value); ReturnValue.Add("param_max_amount", Calc.GetParameters().GetParameter("param_max_amount").value); } else { ReturnValue.Add("param_recipient", "One Recipient"); ReturnValue.Add("param_recipientkey", FRecipientKey); } DateTime FromDate = DateTime.MaxValue; DateTime ToDate = DateTime.MinValue; // if no dates are enter use the earliest and latest dates available in the dataset if (string.IsNullOrEmpty(FDateFrom) || string.IsNullOrEmpty(FDateTo)) { foreach (DataRow Row in FMainDS.Tables[TEMP_TABLE_NAME].Rows) { if ((DateTime)Row["DateEntered"] < FromDate) { FromDate = (DateTime)Row["DateEntered"]; } if ((DateTime)Row["DateEntered"] > ToDate) { ToDate = (DateTime)Row["DateEntered"]; } } } if (!string.IsNullOrEmpty(FDateFrom)) { ReturnValue.Add("param_from_date", Convert.ToDateTime(FDateFrom)); } else { ReturnValue.Add("param_from_date", FromDate); } if (!string.IsNullOrEmpty(FDateTo)) { ReturnValue.Add("param_to_date", Convert.ToDateTime(FDateTo)); } else { ReturnValue.Add("param_to_date", ToDate); } return(ReturnValue); }