本文整理汇总了C#中Ict.Petra.Client.MReporting.Logic.TRptCalculator.AddStringParameter方法的典型用法代码示例。如果您正苦于以下问题:C# TRptCalculator.AddStringParameter方法的具体用法?C# TRptCalculator.AddStringParameter怎么用?C# TRptCalculator.AddStringParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ict.Petra.Client.MReporting.Logic.TRptCalculator
的用法示例。
在下文中一共展示了TRptCalculator.AddStringParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: grdChargedFields_ReadControls
private void grdChargedFields_ReadControls(TRptCalculator ACalc, TReportActionEnum AReportAction)
{
String SelectedFieldKeys = "";
if ((FFieldTable != null)
&& rbtSelectedFields.Checked)
{
foreach (DataRow Row in FFieldTable.Rows)
{
if (((bool)Row["Selection"])
&& (ucoConferenceSelection.AllConferenceSelected
|| (!ucoConferenceSelection.AllConferenceSelected && (bool)Row["Used_in_Conference"])))
{
SelectedFieldKeys = SelectedFieldKeys + Row["Unit Key"].ToString() + ',';
}
}
}
if (SelectedFieldKeys.Length > 0)
{
// Remove the last comma
SelectedFieldKeys = SelectedFieldKeys.Remove(SelectedFieldKeys.Length - 1);
}
ACalc.AddStringParameter("param_selectedfieldkeys", SelectedFieldKeys);
if (rbtSelectedFields.Checked)
{
ACalc.AddParameter("param_chargedfields", "Selected Fields");
if ((SelectedFieldKeys.Length == 0)
&& (AReportAction == TReportActionEnum.raGenerate))
{
TVerificationResult VerificationResult = new TVerificationResult(
Catalog.GetString("Select at least one field to calculate the extra costs."),
Catalog.GetString("No field was selected!"),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
}
else
{
ACalc.AddParameter("param_chargedfields", "All Fields");
}
}
示例2: LoadReportData
//
// New methods using the Fast-reports DLL:
private Boolean LoadReportData(TRptCalculator ACalc)
{
Shared.MReporting.TParameterList pm = ACalc.GetParameters();
//
// My report doesn't need a ledger row - only the name of the ledger. And I need the currency formatter..
String LedgerName = TRemote.MFinance.Reporting.WebConnectors.GetLedgerName(FLedgerNumber);
ACalc.AddStringParameter("param_ledger_name", LedgerName);
ACalc.AddStringParameter("param_currency_formatter", "0,0.000");
ACalc.AddParameter("param_period", true);
ACalc.AddStringParameter("param_linked_partner_cc", ""); // Used for auto-emailing HOSAs, this is usually blank.
// 0 = Full Report. Currently the only option for this report.
pm.Add("param_ich_number", 0);
return LoadReportDataStaticInner(this, FPetraUtilsObject, FPetraUtilsObject.FFastReportsPlugin, ACalc);
}
示例3: PrintReportNoUi
/// <summary>Helper for the report printing ClientTask</summary>
/// <param name="ReportName"></param>
/// <param name="paramStr"></param>
public static void PrintReportNoUi(String ReportName, String paramStr)
{
String[] Params = paramStr.Split(',');
Int32 LedgerNumber = -1;
Int32 BatchNumber = -1;
/*
* String Msg = ReportName + "\n";
* foreach (String param in Params)
* {
* Msg += (param + "\n");
* }
* MessageBox.Show(Msg, "FastReportWrapper.PrintReportNoUi");
*/
FastReportsWrapper ReportingEngine = new FastReportsWrapper(ReportName);
if (!ReportingEngine.LoadedOK)
{
ReportingEngine.ShowErrorPopup();
return;
}
Dictionary <String, TVariant>paramsDictionary = new Dictionary <string, TVariant>();
TRptCalculator Calc = new TRptCalculator();
//
// Copy paramters to report:
foreach (String param in Params)
{
String[] term = param.Split('=');
if (term.Length > 1)
{
if (term[1][0] == '"') // This is a string
{
String val = term[1].Substring(1, term[1].Length - 2);
Calc.AddStringParameter(term[0], val);
paramsDictionary.Add(term[0], new TVariant(val));
}
else // This is a number - Int32 assumed.
{
Int32 IntTerm;
if (Int32.TryParse(term[1], out IntTerm))
{
Calc.AddParameter(term[0], IntTerm);
paramsDictionary.Add(term[0], new TVariant(IntTerm));
//
// As I'm adding these values, I'll keep a note of any that may be useful later..
switch (term[0])
{
case "param_ledger_number_i":
{
LedgerNumber = IntTerm;
break;
}
case "param_batch_number_i":
{
BatchNumber = IntTerm;
break;
}
}
}
else
{
MessageBox.Show("Error: Parameter not recognised: " + param, "FastReportWrapper.PrintReportNoUi");
}
}
}
else
{
MessageBox.Show("Error: malformed Parameter: " + param, "FastReportWrapper.PrintReportNoUi");
}
} // foreach param
//
// Get Data for report:
switch (ReportName)
{
case "Batch Posting Register":
{
if ((LedgerNumber != -1) && (BatchNumber != -1))
{
ReportingEngine.RegisterBatchPostingData(Calc, LedgerNumber, BatchNumber);
}
else
{
MessageBox.Show("Error: Can't get data for Batch Posting Register", "FastReportWrapper.PrintReportNoUi");
}
break;
}
case "Gift Batch Detail":
{
//.........这里部分代码省略.........
示例4: AutoEmailReports
/// <summary>
/// The report will be sent to a list of email addresses derived from the Cost Centres in the supplied CostCentreFilter.
/// </summary>
/// <returns>Status string that should be shown to the user</returns>
public static String AutoEmailReports(TFrmPetraReportingUtils FormUtils, FastReportsWrapper ReportEngine,
TRptCalculator ACalc, Int32 ALedgerNumber, String ACostCentreFilter)
{
Int32 SuccessfulCount = 0;
String NoEmailAddr = "";
String FailedAddresses = "";
String SendReport = "";
//
// I need to find the email addresses for the linked partners I'm sending to.
DataTable LinkedPartners = null;
LinkedPartners = TRemote.MFinance.Setup.WebConnectors.GetLinkedPartners(ALedgerNumber, ACostCentreFilter);
LinkedPartners.DefaultView.Sort = "CostCentreCode";
foreach (DataRowView rv in LinkedPartners.DefaultView)
{
DataRow LinkedPartner = rv.Row;
if (LinkedPartner["EmailAddress"].ToString() != "")
{
ACalc.AddStringParameter("param_linked_partner_cc", LinkedPartner["CostCentreCode"].ToString());
FormUtils.WriteToStatusBar("Generate " + ReportEngine.FReportName + " Report for " + LinkedPartner["PartnerShortName"]);
MemoryStream ReportStream = ReportEngine.ExportToStream(ACalc, FastReportsWrapper.ReportExportType.Html);
if (ReportStream.Position < 1000)
{
continue; // Don't send an empty report
}
ReportStream.Position = 0;
TUC_EmailPreferences.LoadEmailDefaults();
TSmtpSender EmailSender = new TSmtpSender(
TUserDefaults.GetStringDefault("SmtpHost"),
TUserDefaults.GetInt16Default("SmtpPort"),
TUserDefaults.GetBooleanDefault("SmtpUseSsl"),
TUserDefaults.GetStringDefault("SmtpUser"),
TUserDefaults.GetStringDefault("SmtpPassword"),
"");
EmailSender.CcEverythingTo = TUserDefaults.GetStringDefault("SmtpCcTo");
EmailSender.ReplyTo = TUserDefaults.GetStringDefault("SmtpReplyTo");
if (!EmailSender.FInitOk)
{
return String.Format(
Catalog.GetString(
"Failed to set up the email server.\n Please check the settings in Preferences / Email.\n Message returned : \"{0}\""),
EmailSender.FErrorStatus);
}
String EmailBody = "";
if (TUserDefaults.GetBooleanDefault("SmtpSendAsAttachment"))
{
EmailBody = TUserDefaults.GetStringDefault("SmtpEmailBody");
EmailSender.AttachFromStream(ReportStream, ReportEngine.FReportName + ".html");
}
else
{
StreamReader sr = new StreamReader(ReportStream);
EmailBody = sr.ReadToEnd();
}
Boolean SentOk = EmailSender.SendEmail(
TUserDefaults.GetStringDefault("SmtpFromAccount"),
TUserDefaults.GetStringDefault("SmtpDisplayName"),
"[email protected]", //LinkedPartner["EmailAddress"]
ReportEngine.FReportName + " Report for " + LinkedPartner["PartnerShortName"] + ", Address=" + LinkedPartner["EmailAddress"],
EmailBody);
if (SentOk)
{
SuccessfulCount++;
}
else // Email didn't send for some reason
{
SendReport += String.Format(
Catalog.GetString("\r\nFailed to send to {0}. Message returned: \"{1}\"."),
LinkedPartner["EmailAddress"],
EmailSender.FErrorStatus
);
FailedAddresses += ("\r\n " + LinkedPartner["EmailAddress"]);
}
}
else // No Email Address for this Partner
{
NoEmailAddr += ("\r\n " + LinkedPartner["PartnerKey"] + " " + LinkedPartner["PartnerShortName"]);
}
}
if (SuccessfulCount > 0)
{
SendReport +=
String.Format(Catalog.GetString("\r\n{0} emailed to {1} addresses."), ReportEngine.FReportName, SuccessfulCount) + "\r\n\r\n";
//.........这里部分代码省略.........
示例5: FilePrint
/// <summary>
/// Print out the Hierarchy using FastReports template.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FilePrint(object sender, EventArgs e)
{
FastReportsWrapper ReportingEngine = new FastReportsWrapper("Account Hierarchy");
if (!ReportingEngine.LoadedOK)
{
ReportingEngine.ShowErrorPopup();
return;
}
if (!FMainDS.AAccount.Columns.Contains("AccountPath"))
{
FMainDS.AAccount.Columns.Add("AccountPath", typeof(String));
FMainDS.AAccount.Columns.Add("AccountLevel", typeof(Int32));
}
DataView PathView = new DataView(FMainDS.AAccountHierarchyDetail);
PathView.Sort = "a_reporting_account_code_c";
DataView AccountView = new DataView(FMainDS.AAccount);
AccountView.Sort = "a_account_code_c";
// I need to make the "AccountPath" field that will be used to sort the table for printout:
foreach (DataRowView rv in PathView)
{
DataRow Row = rv.Row;
String AccountCode = Row["a_reporting_account_code_c"].ToString();
String Path = Row["a_report_order_i"] + "-" + AccountCode + '~';
Int32 Level = 0;
String ReportsTo = Row["a_account_code_to_report_to_c"].ToString();
while (ReportsTo != "")
{
Int32 ParentIdx = PathView.Find(ReportsTo);
if (ParentIdx >= 0)
{
DataRow ParentRow = PathView[ParentIdx].Row;
ReportsTo = ParentRow["a_account_code_to_report_to_c"].ToString();
Path = ParentRow["a_report_order_i"] + "-" + ParentRow["a_reporting_account_code_c"].ToString() + "~" + Path;
Level++;
if (Level > 100) // Surely this is a fault. If I just break here,
{
break; // the report will print and I should be able to see what the fault is.
}
}
else
{
ReportsTo = "";
}
}
Int32 AccountIdx = AccountView.Find(AccountCode);
DataRow AccountRow = AccountView[AccountIdx].Row;
AccountRow["AccountPath"] = Path;
AccountRow["AccountLevel"] = Level;
}
AccountView.Sort = "AccountPath";
DataTable SortedByPath = AccountView.ToTable();
ReportingEngine.RegisterData(SortedByPath, "AccountHierarchy");
ReportingEngine.RegisterData(FMainDS.AAnalysisAttribute, "AnalysisAttribute");
TRptCalculator Calc = new TRptCalculator();
ALedgerRow LedgerRow = FMainDS.ALedger[0];
Calc.AddParameter("param_ledger_number_i", LedgerRow.LedgerNumber);
Calc.AddStringParameter("param_ledger_name", LedgerRow.LedgerName);
if (ModifierKeys.HasFlag(Keys.Control))
{
ReportingEngine.DesignReport(Calc);
}
else
{
ReportingEngine.GenerateReport(Calc);
}
}
示例6: PrintReportNoUi
} // AutoEmailReports
/// <summary>
///
/// </summary>
/// <param name="ReportName"></param>
/// <param name="paramStr"></param>
public static void PrintReportNoUi(String ReportName, String paramStr)
{
String[] Params = paramStr.Split(',');
Int32 LedgerNumber = -1;
Int32 BatchNumber = -1;
/*
* String Msg = ReportName + "\n";
* foreach (String param in Params)
* {
* Msg += (param + "\n");
* }
* MessageBox.Show(Msg, "FastReportWrapper.PrintReportNoUi");
*/
FastReportsWrapper ReportingEngine = new FastReportsWrapper(ReportName);
if (!ReportingEngine.LoadedOK)
{
ReportingEngine.ShowErrorPopup();
return;
}
TRptCalculator Calc = new TRptCalculator();
//
// Copy paramters to report:
foreach (String param in Params)
{
String[] term = param.Split('=');
if (term.Length > 1)
{
if (term[1][0] == '"') // This is a string
{
Calc.AddStringParameter(term[0], term[1].Substring(1, term[1].Length - 2));
}
else // This is a number - Int32 assumed.
{
Int32 IntTerm;
if (Int32.TryParse(term[1], out IntTerm))
{
Calc.AddParameter(term[0], IntTerm);
//
// As I'm adding these values, I'll keep a note of any that may be useful later..
switch (term[0])
{
case "param_ledger_number_i":
{
LedgerNumber = IntTerm;
break;
}
case "param_batch_number_i":
{
BatchNumber = IntTerm;
break;
}
}
}
else
{
MessageBox.Show("Error: Parameter not recognised: " + param, "FastReportWrapper.PrintReportNoUi");
}
}
}
else
{
MessageBox.Show("Error: malformed Parameter: " + param, "FastReportWrapper.PrintReportNoUi");
}
} // foreach
//
// Get Data for report:
switch (ReportName)
{
case "Batch Posting Register":
{
if ((LedgerNumber != -1) && (BatchNumber != -1))
{
GLBatchTDS BatchTDS = TRemote.MFinance.GL.WebConnectors.LoadABatchAndContent(LedgerNumber, BatchNumber);
ReportingEngine.RegisterData(BatchTDS.ABatch, "ABatch");
ReportingEngine.RegisterData(BatchTDS.AJournal, "AJournal");
ReportingEngine.RegisterData(BatchTDS.ATransaction, "ATransaction");
}
else
{
MessageBox.Show("Error: Can't get data for Batch Posting Register", "FastReportWrapper.PrintReportNoUi");
}
break;
}
//.........这里部分代码省略.........
示例7: LoadReportData
//
// This will be called if the Fast Reports Wrapper loaded OK.
// Returns True if the data apparently loaded OK and the report should be printed.
private bool LoadReportData(TRptCalculator ACalc)
{
ArrayList reportParam = ACalc.GetParameters().Elems;
Dictionary <String, TVariant>paramsDictionary = new Dictionary <string, TVariant>();
foreach (Shared.MReporting.TParameter p in reportParam)
{
if (p.name.StartsWith("param") && (p.name != "param_calculation") && (!paramsDictionary.ContainsKey(p.name)))
{
paramsDictionary.Add(p.name, p.value);
}
}
Int32 ParamNestingDepth = 6;
String DepthOption = paramsDictionary["param_depth"].ToString();
if (DepthOption == "standard")
{
ParamNestingDepth = 3;
}
paramsDictionary.Add("param_nesting_depth", new TVariant(ParamNestingDepth));
String RootCostCentre = "[" + FLedgerNumber + "]";
paramsDictionary.Add("param_cost_centre_code", new TVariant(RootCostCentre));
//
// The table contains extra rows for "headers" and "footers", facilitating the hierarchical printout.
DataTable ReportTable = TRemote.MReporting.WebConnectors.GetReportDataTable("BalanceSheet", paramsDictionary);
if (this.IsDisposed)
{
return false;
}
if (ReportTable == null)
{
FPetraUtilsObject.WriteToStatusBar("Report Cancelled.");
return false;
}
FPetraUtilsObject.FFastReportsPlugin.RegisterData(ReportTable, "BalanceSheet");
//
// I need to get the name of the current ledger..
DataTable LedgerNameTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerNameList);
DataView LedgerView = new DataView(LedgerNameTable);
LedgerView.RowFilter = "LedgerNumber=" + FLedgerNumber;
String LedgerName = "";
if (LedgerView.Count > 0)
{
LedgerName = LedgerView[0].Row["LedgerName"].ToString();
}
ACalc.AddStringParameter("param_ledger_name", LedgerName);
return true;
}
示例8: foreach
private Dictionary <String, TVariant>InitialiseDictionary(TRptCalculator ACalc)
{
Shared.MReporting.TParameterList pm = ACalc.GetParameters();
pm.Add("param_ledger_number_i", FLedgerNumber);
String LedgerName = TRemote.MFinance.Reporting.WebConnectors.GetLedgerName(FLedgerNumber);
ACalc.AddStringParameter("param_ledger_name", LedgerName);
ACalc.AddParameter("param_currency_name", FLedgerRow.BaseCurrency); // Stewardship reports are always in Base Currency.
ACalc.AddStringParameter("param_currency_formatter", "0,0.000");
ACalc.AddParameter("param_ich_number", pm.Get("param_cmbICHNumber").ToInt32());
ACalc.AddParameter("param_period", true);
Int32 period = pm.Get("param_cmbReportPeriod").ToInt32();
Int32 PeriodStart = Math.Max(1, period);
Int32 PeriodEnd = period;
if (PeriodEnd == 0)
{
PeriodEnd = TFinanceControls.GetLedgerNumPeriods(FLedgerNumber);
}
Int32 Year = pm.Get("param_cmbYearEnding").ToInt32();
ACalc.AddParameter("param_start_period_i", PeriodStart);
ACalc.AddParameter("param_end_period_i", PeriodEnd);
DateTime StartDate = TRemote.MFinance.GL.WebConnectors.GetPeriodStartDate(FLedgerNumber, Year, 0, PeriodStart);
DateTime EndDate = TRemote.MFinance.GL.WebConnectors.GetPeriodEndDate(FLedgerNumber, Year, 0, PeriodEnd);
ACalc.AddParameter("param_real_year", StartDate.Year);
ACalc.AddParameter("param_start_date", StartDate);
ACalc.AddParameter("param_end_date", EndDate);
ACalc.AddParameter("param_current_financial_year", FLedgerRow.CurrentFinancialYear == Year);
Boolean IsClosed = (Year < FLedgerRow.CurrentFinancialYear) || (PeriodEnd < FLedgerRow.CurrentPeriod);
ACalc.AddParameter("param_period_closed", IsClosed);
Boolean IsCurrent = (Year == FLedgerRow.CurrentFinancialYear) && (PeriodEnd == FLedgerRow.CurrentPeriod);
ACalc.AddParameter("param_period_current", IsCurrent);
ACalc.AddParameter("param_year_i", Year);
ArrayList reportParam = pm.Elems;
Dictionary <String, TVariant>paramsDictionary = new Dictionary <string, TVariant>();
foreach (Shared.MReporting.TParameter p in reportParam)
{
if (p.name.StartsWith("param") && (p.name != "param_calculation"))
{
paramsDictionary.Add(p.name, p.value);
}
}
return paramsDictionary;
} // Initialise Dictionary
示例9: ReadControlsManual
private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
{
String paramFields = clbFields.GetCheckedStringList(true);
if (AReportAction == TReportActionEnum.raGenerate)
{
if (rbtSelectedFields.Checked && (paramFields.Length == 0))
{
TVerificationResult VerificationMessage = new TVerificationResult(
Catalog.GetString("Please select at least one field."),
Catalog.GetString("No fields selected!"), TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationMessage);
}
if (rbtAllFields.Checked)
{
paramFields = clbFields.GetAllStringList(true);
}
if (!dtpFromDate.ValidDate() || !dtpToDate.ValidDate())
{
TVerificationResult VerificationResult = new TVerificationResult(
Catalog.GetString("Date format problem"),
Catalog.GetString("Please check the date entry."),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
if (dtpFromDate.Date > dtpToDate.Date)
{
TVerificationResult VerificationResult = new TVerificationResult(
Catalog.GetString("From date is later than to date."),
Catalog.GetString("Please change from date or to date."),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
}
paramFields = paramFields.Replace("\"", "'"); // single quotes for SQL field names.
ACalc.AddParameter("param_clbFields", paramFields);
ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
//
// I need to get the name of the current ledger..
DataTable LedgerNameTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerNameList);
DataView LedgerView = new DataView(LedgerNameTable);
LedgerView.RowFilter = "LedgerNumber=" + FLedgerNumber;
String LedgerName = "";
if (LedgerView.Count > 0)
{
LedgerName = LedgerView[0].Row["LedgerName"].ToString();
}
ACalc.AddStringParameter("param_ledger_name", LedgerName);
ALedgerTable LedgerDetailsTable = (ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerDetails);
ALedgerRow Row = LedgerDetailsTable[0];
Int32 LedgerYear = Row.CurrentFinancialYear;
Int32 NumPeriods = Row.NumberOfAccountingPeriods;
String CurrencyName = (cmbCurrency.SelectedItem.ToString() == "Base") ? Row.BaseCurrency : Row.IntlCurrency;
ACalc.AddStringParameter("param_currency_name", CurrencyName);
ACalc.AddParameter("param_year0", DateTime.Today.Year);
ACalc.AddParameter("param_year1", DateTime.Today.Year - 1);
ACalc.AddParameter("param_year2", DateTime.Today.Year - 2);
ACalc.AddParameter("param_year3", DateTime.Today.Year - 3);
} // Read Controls Manual
示例10: LoadStewardshipReportData
private Boolean LoadStewardshipReportData(TRptCalculator ACalc)
{
Shared.MReporting.TParameterList pm = ACalc.GetParameters();
pm.Add("param_ledger_number_i", FLedgerNumber);
ArrayList reportParam = pm.Elems;
Dictionary <String, TVariant>paramsDictionary = new Dictionary <string, TVariant>();
foreach (Shared.MReporting.TParameter p in reportParam)
{
if (p.name.StartsWith("param") && (p.name != "param_calculation"))
{
paramsDictionary.Add(p.name, p.value);
}
}
// pm.Add("param_current_period", uco_GeneralSettings.GetCurrentPeiod());
DataTable ReportTable = TRemote.MReporting.WebConnectors.GetReportDataTable("Stewardship", paramsDictionary);
if (this.IsDisposed)
{
return false;
}
if (ReportTable == null)
{
FPetraUtilsObject.WriteToStatusBar("Report Cancelled.");
return false;
}
MyFastReportsPlugin.RegisterData(ReportTable, "Stewardship");
//
// My report doesn't need a ledger row - only the name of the ledger. And I need the currency formatter..
String LedgerName = TRemote.MFinance.Reporting.WebConnectors.GetLedgerName(FLedgerNumber);
ACalc.AddStringParameter("param_ledger_name", LedgerName);
ACalc.AddStringParameter("param_currency_formatter", "0,0.000");
Boolean HasData = (ReportTable.Rows.Count > 0);
if (!HasData)
{
MessageBox.Show(Catalog.GetString("No Stewardship entries found for selected Run Number."), "Stewardship");
}
return HasData;
}
示例11: ReadControlsManual
/// <summary>
///
/// </summary>
/// <param name="ACalculator"></param>
/// <param name="AReportAction"></param>
private void ReadControlsManual(TRptCalculator ACalculator, TReportActionEnum AReportAction)
{
TVerificationResult VerificationResult;
string PublicationCodesToAdd = string.Empty;
// Disabled selecting all publications for now as report currently cuts them off.
// Can show a maximum of 8.
/*if (rbtFromList.Checked)
* {*/
string SelectedPublicationCodes = clbPublicationCode.GetCheckedStringList(true);
PublicationCodesToAdd = clbPublicationCode.GetCheckedStringList(false);
if (AReportAction == TReportActionEnum.raGenerate)
{
if (clbPublicationCode.CheckedItemsCount == 0)
{
VerificationResult = new TVerificationResult(Catalog.GetString("Select Publication Codes"),
Catalog.GetString("No Publication Code was selected!"),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
else if (clbPublicationCode.CheckedItemsCount > 8)
{
VerificationResult = new TVerificationResult(Catalog.GetString("Select Publication Codes"),
string.Format(Catalog.GetString("You have selected {0} publications. Please reduce this number to 8 or fewer."),
clbPublicationCode.CheckedItemsCount),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
}
ACalculator.AddStringParameter("param_clbPublicationCode", SelectedPublicationCodes);
if (SelectedPublicationCodes.Length > 25)
{
SelectedPublicationCodes = "Selected Accounts";
}
ACalculator.AddParameter("param_publication_list_title", SelectedPublicationCodes);
/*}
* else
* {
* PublicationCodesToAdd = clbPublicationCode.GetAllStringList();
* }*/
if (AReportAction == TReportActionEnum.raGenerate)
{
StringCollection PublicationCodesToAddSC = StringHelper.GetCSVList(PublicationCodesToAdd, ",");
int ColumnCounter = 0;
double Position = 0;
// add extra parameters for user defined columns
while (ACalculator.GetParameters().GetParameter("param_calculation", ColumnCounter, -1, eParameterFit.eAllColumnFit) != null)
{
string Description =
ACalculator.GetParameters().GetParameter("param_calculation", ColumnCounter, -1, eParameterFit.eAllColumnFit).value.ToString();
double Width =
ACalculator.GetParameters().GetParameter("ColumnWidth", ColumnCounter, -1, eParameterFit.eAllColumnFit).value.ToDouble();
ACalculator.AddParameter("param_label", Description, ColumnCounter);
ACalculator.AddParameter("ColumnAlign", "left", ColumnCounter);
ACalculator.AddParameter("ColumnCaption", Description, ColumnCounter);
ACalculator.AddParameter("ColumnPosition", Position, ColumnCounter);
Position += Width;
++ColumnCounter;
}
double ColumnWidth = 2.3;
// add a new column for each publication
foreach (string Code in PublicationCodesToAddSC)
{
ACalculator.AddParameter("param_calculation", "Publication", ColumnCounter);
ACalculator.AddParameter("param_label", "Publication", ColumnCounter);
ACalculator.AddParameter("ColumnAlign", "left", ColumnCounter);
ACalculator.AddParameter("ColumnCaption", Code, ColumnCounter);
ACalculator.AddParameter("ColumnPosition", Position, ColumnCounter);
ACalculator.AddParameter("ColumnWidth", ColumnWidth, ColumnCounter);
Position += ColumnWidth;
++ColumnCounter;
}
ACalculator.SetMaxDisplayColumns(ColumnCounter);
// get the country code for this openpetra's site ledger
string CountryCode = TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetCountryCodeFromSiteLedger();
ACalculator.AddParameter("param_cmbCountryCode", CountryCode);
//.........这里部分代码省略.........
示例12: LoadReportData
//
// This will be called if the Fast Reports Wrapper loaded OK.
// Returns True if the data apparently loaded OK and the report should be printed.
private bool LoadReportData(TRptCalculator ACalc)
{
//
// I need to get the name of the current ledger..
DataTable LedgerNameTable = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerNameList);
DataView LedgerView = new DataView(LedgerNameTable);
LedgerView.RowFilter = "LedgerNumber=" + FLedgerNumber;
String LedgerName = "";
if (LedgerView.Count > 0)
{
LedgerName = LedgerView[0].Row["LedgerName"].ToString();
}
if (!Int32.TryParse(txtBatchNumber.Text, out FBatchNumber))
{
MessageBox.Show(
Catalog.GetString("Fault: No valid Batch number"),
Catalog.GetString("Gift Batch Detail"));
return false;
}
ACalc.AddStringParameter("param_ledger_name", LedgerName);
ACalc.AddStringParameter("param_linked_partner_cc", ""); // I may want to use this for auto_email, but usually it's unused.
if (ACalc.GetParameters().Exists("param_currency")
&& (ACalc.GetParameters().Get("param_currency").ToString() == Catalog.GetString("Transaction")))
{
ACalc.RemoveParameter("param_currency_name");
ACalc.AddParameter("param_currency_name",
TRemote.MFinance.Reporting.WebConnectors.GetTransactionCurrency(FLedgerNumber, FBatchNumber));
}
ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
ACalc.AddParameter("param_batch_number_i", FBatchNumber);
ArrayList reportParam = ACalc.GetParameters().Elems;
Dictionary <String, TVariant>paramsDictionary = new Dictionary <string, TVariant>();
foreach (Shared.MReporting.TParameter p in reportParam)
{
if (p.name.StartsWith("param") && (p.name != "param_calculation") && (!paramsDictionary.ContainsKey(p.name)))
{
paramsDictionary.Add(p.name, p.value);
}
}
DataTable ReportTable = TRemote.MReporting.WebConnectors.GetReportDataTable("GiftBatchDetail", paramsDictionary);
if (this.IsDisposed) // There's no cancel function as such - if the user has pressed Esc the form is closed!
{
return false;
}
if (ReportTable == null)
{
FPetraUtilsObject.WriteToStatusBar("Report Cancelled.");
return false;
}
FPetraUtilsObject.FFastReportsPlugin.RegisterData(ReportTable, "GiftBatchDetail");
return true;
}
示例13: ReadControls
//.........这里部分代码省略.........
}
else if (rbtAllConferences.Checked)
{
ACalculator.AddParameter("param_conferenceselection", "all conferences");
}
if (rbtAllAttendees.Checked)
{
ACalculator.AddParameter("param_attendeeselection", "all attendees");
}
else if (rbtExtract.Checked)
{
ACalculator.AddParameter("param_attendeeselection", "from extract");
}
else if (rbtOneAttendee.Checked)
{
ACalculator.AddParameter("param_attendeeselection", "one attendee");
}
ACalculator.AddParameter("param_partnerkey", txtOneAttendee.Text);
ACalculator.AddParameter("param_conferencekey", txtConference.Text);
ACalculator.AddParameter("param_conferencename", txtConference.LabelText);
ACalculator.AddParameter("param_extractname", txtExtract.Text);
TVerificationResult VerificationResult;
if ((AReportAction == TReportActionEnum.raGenerate)
&& (rbtExtract.Checked)
&& (txtExtract.Text.Length == 0))
{
VerificationResult = new TVerificationResult(Catalog.GetString("Select an extract for running the report."),
Catalog.GetString("No extract was selected!"),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
if ((AReportAction == TReportActionEnum.raGenerate)
&& (rbtOneAttendee.Checked)
&& (txtOneAttendee.Text == "0000000000"))
{
VerificationResult = new TVerificationResult(Catalog.GetString("Select a partner for whom to run the report."),
Catalog.GetString("No partner was selected!"),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
if ((AReportAction == TReportActionEnum.raGenerate)
&& (rbtConference.Checked)
&& (txtConference.Text == "0000000000"))
{
VerificationResult = new TVerificationResult(Catalog.GetString("Select a conference to run the report against to."),
Catalog.GetString("No conference was selected!"),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
if (FShowSelectOutreachOptionsDialog
&& (AReportAction == TReportActionEnum.raGenerate)
&& (rbtConference.Checked)
&& (FPetraUtilsObject.GetVerificationResultCount() == 0))
{
List <KeyValuePair <long, string>>ConferenceList;
DialogResult DlgResult = TFrmSelectOutreachOption.OpenSelectOutreachOptionDialog(
Convert.ToInt64(txtConference.Text), FPetraUtilsObject.GetForm(), true, out ConferenceList);
if (((DlgResult != DialogResult.OK) || (ConferenceList.Count == 0))
&& (DlgResult != DialogResult.None))
{
VerificationResult = new TVerificationResult(
Catalog.GetString("You must chose at least one outreach option from the \"Select Outreach Option\" Dialog."),
Catalog.GetString("No outreach option was selected!"),
TResultSeverity.Resv_Critical);
FPetraUtilsObject.AddVerificationResult(VerificationResult);
}
string OutreachOptions = "";
string OutreachOptionsCode = "";
foreach (KeyValuePair <long, string>OutreachOption in ConferenceList)
{
OutreachOptions = OutreachOptions + OutreachOption.Key.ToString() + ",";
OutreachOptionsCode = OutreachOptionsCode + OutreachOption.Value + ",";
}
if (OutreachOptions.Length > 0)
{
// Remove the last comma
OutreachOptions = OutreachOptions.Remove(OutreachOptions.Length - 1);
OutreachOptionsCode = OutreachOptionsCode.Remove(OutreachOptionsCode.Length - 1);
}
else
{
OutreachOptions = txtConference.Text;
OutreachOptionsCode = txtConference.LabelText;
}
ACalculator.AddStringParameter("param_conferenceoptions", OutreachOptions);
ACalculator.AddParameter("param_conferenceoptionscode", OutreachOptionsCode);
}
}
示例14: ReadControlsManual
private void ReadControlsManual(TRptCalculator ACalc, TReportActionEnum AReportAction)
{
ACalc.AddParameter("param_ledger_number_i", FLedgerNumber);
ACalc.AddColumnLayout(0, 8, 0, 3);
ACalc.AddColumnLayout(1, 11, 0, 3);
ACalc.AddColumnLayout(2, 14, 0, 7);
ACalc.SetMaxDisplayColumns(3);
ACalc.AddColumnCalculation(0, "Debit");
ACalc.AddColumnCalculation(1, "Credit");
ACalc.AddColumnCalculation(2, "Transaction Narrative");
ACalc.AddParameter("param_daterange", "false");
ACalc.AddParameter("param_rgrAccounts", "AllAccounts");
ACalc.AddParameter("param_rgrCostCentres", "CostCentreList");
// TODO need to allow to specify an ICH run number
ACalc.AddParameter("param_ich_number", 0);
ACalc.AddParameter("param_include_rgs", false);
ACalc.AddStringParameter("param_cost_centre_codes", clbCostCentres.GetCheckedStringList(true));
}
示例15: FilePrint
/// <summary>
/// Print out the Hierarchy using FastReports template.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FilePrint(object sender, EventArgs e)
{
TLogging.Log("CostCentreHierarchy.File Print..");
FastReportsWrapper ReportingEngine = new FastReportsWrapper("Cost Centre Hierarchy");
if (!ReportingEngine.LoadedOK)
{
ReportingEngine.ShowErrorPopup();
return;
}
if (!FMainDS.ACostCentre.Columns.Contains("CostCentrePath"))
{
FMainDS.ACostCentre.Columns.Add("CostCentrePath", typeof(String));
FMainDS.ACostCentre.Columns.Add("CostCentreLevel", typeof(Int32));
}
DataView PathView = new DataView(FMainDS.ACostCentre);
PathView.Sort = "a_cost_centre_code_c";
TLogging.Log("CostCentreHierarchy.File Print calculating paths..");
// I need to make the "CostCentrePath" field that will be used to sort the table for printout:
foreach (DataRowView rv in PathView)
{
DataRow Row = rv.Row;
String Path = Row["a_cost_centre_code_c"].ToString() + '~';
Int32 Level = 0;
String ReportsTo = Row["a_cost_centre_to_report_to_c"].ToString();
while (ReportsTo != "")
{
Int32 ParentIdx = PathView.Find(ReportsTo);
if (ParentIdx >= 0)
{
DataRow ParentRow = PathView[ParentIdx].Row;
ReportsTo = ParentRow["a_cost_centre_to_report_to_c"].ToString();
Path = ParentRow["a_cost_centre_code_c"].ToString() + "~" + Path;
Level++;
if (Level > 100) // Surely this is a fault. If I just break here,
{
break; // the report will print and I should be able to see what the fault is.
}
}
else
{
ReportsTo = "";
}
}
Row["CostCentrePath"] = Path;
Row["CostCentreLevel"] = Level;
}
PathView.Sort = "CostCentrePath";
DataTable SortedByPath = PathView.ToTable();
TLogging.Log("CostCentreHierarchy.File Print paths all done.");
ReportingEngine.RegisterData(SortedByPath, "CostCentreHierarchy");
TRptCalculator Calc = new TRptCalculator();
ALedgerRow LedgerRow = FMainDS.ALedger[0];
Calc.AddParameter("param_ledger_nunmber", LedgerRow.LedgerNumber);
Calc.AddStringParameter("param_ledger_name", LedgerRow.LedgerName);
TLogging.Log("CostCentreHierarchy.File Print calling FastReport...");
if (ModifierKeys.HasFlag(Keys.Control))
{
ReportingEngine.DesignReport(Calc);
}
else
{
ReportingEngine.GenerateReport(Calc);
}
}