/// <summary> /// Print out the Motivation Details using FastReports template. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilePrint(object sender, EventArgs e) { FastReportsWrapper ReportingEngine = new FastReportsWrapper("Motivation Details"); if (!ReportingEngine.LoadedOK) { ReportingEngine.ShowErrorPopup(); return; } ReportingEngine.RegisterData(FMainDS.AMotivationDetail, "MotivationDetail"); 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); } }
/// <summary> /// Print or reprint the posting report for this batch. /// </summary> public static void PrintPostingRegister(Int32 ALedgerNumber, Int32 ABatchNumber, Boolean AEditTemplate = false) { FastReportsWrapper ReportingEngine = new FastReportsWrapper("Batch Posting Register"); if (!ReportingEngine.LoadedOK) { ReportingEngine.ShowErrorPopup(); return; } GLBatchTDS BatchTDS = TRemote.MFinance.GL.WebConnectors.LoadABatchAndContent(ALedgerNumber, ABatchNumber); TRptCalculator Calc = new TRptCalculator(); ALedgerRow LedgerRow = BatchTDS.ALedger[0]; //Call RegisterData to give the data to the template ReportingEngine.RegisterData(BatchTDS.ABatch, "ABatch"); ReportingEngine.RegisterData(BatchTDS.AJournal, "AJournal"); ReportingEngine.RegisterData(BatchTDS.ATransaction, "ATransaction"); Calc.AddParameter("param_batch_number_i", ABatchNumber); Calc.AddParameter("param_ledger_number_i", ALedgerNumber); String LedgerName = TRemote.MFinance.Reporting.WebConnectors.GetLedgerName(ALedgerNumber); Calc.AddStringParameter("param_ledger_name", LedgerName); if (AEditTemplate) { ReportingEngine.DesignReport(Calc); } else { ReportingEngine.GenerateReport(Calc); } }
/// <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("Duplicate Address Check"); if (!ReportingEngine.LoadedOK) { ReportingEngine.ShowErrorPopup(); return; } ReportingEngine.RegisterData(FDuplicateLocations, "DuplicateLocations"); TRptCalculator Calc = new TRptCalculator(); if (ModifierKeys.HasFlag(Keys.Control)) { ReportingEngine.DesignReport(Calc); } else { ReportingEngine.GenerateReport(Calc); } }
/// <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); } }
/// <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); } }
/// <summary> /// Print out the Motivation Details using FastReports template. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilePrint(object sender, EventArgs e) { FastReportsWrapper ReportingEngine = new FastReportsWrapper("Motivation Details"); if (!ReportingEngine.LoadedOK) { ReportingEngine.ShowErrorPopup(); return; } // Add in the Fees applicable for each row: if (!FMainDS.AMotivationDetail.Columns.Contains("Fees")) { FMainDS.AMotivationDetail.Columns.Add("Fees", typeof(String)); FMainDS.AMotivationDetail.Columns.Add("KeyMin", typeof(String)); } foreach (AMotivationDetailRow Row in FMainDS.AMotivationDetail.Rows) { FMainDS.AMotivationDetailFee.DefaultView.RowFilter = String.Format( "a_motivation_group_code_c='{0}' AND a_motivation_detail_code_c='{1}'", Row.MotivationGroupCode, Row.MotivationDetailCode); String Fees = ""; foreach (DataRowView rv in FMainDS.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow FeeRow = (AMotivationDetailFeeRow)rv.Row; if (Fees != "") { Fees += ", "; } Fees += FeeRow.FeeCode; } Row["Fees"] = Fees; if (Row.RecipientKey != 0) { String mPartnerShortName; TPartnerClass mPartnerClass; if (TServerLookup.TMPartner.GetPartnerShortName(Row.RecipientKey, out mPartnerShortName, out mPartnerClass, true)) { Row["KeyMin"] = mPartnerShortName; } } } // foreach // // Ensure the proper sorting for the printout: FMainDS.AMotivationDetail.DefaultView.Sort = "a_motivation_group_code_c, a_motivation_detail_code_c"; ReportingEngine.RegisterData(FMainDS.AMotivationDetail.DefaultView.ToTable(), "MotivationDetail"); TRptCalculator Calc = new TRptCalculator(); ALedgerRow LedgerRow = FMainDS.ALedger[0]; Calc.AddParameter("param_ledger_number_i", LedgerRow.LedgerNumber); Calc.AddStringParameter("param_ledger_name", LedgerRow.LedgerName); Calc.AddParameter("param_TD", FTaxDeductiblePercentageEnabled); if (ModifierKeys.HasFlag(Keys.Control)) { ReportingEngine.DesignReport(Calc); } else { ReportingEngine.GenerateReport(Calc); } }