/// <summary> /// Insert the values of a data row into the report results. /// The data row contains for each room / venue the bookings. /// </summary> /// <param name="ANumColumns">Number of columns the report has</param> /// <param name="AChildRow">Index of the child row</param> /// <param name="ADataRow">The data row which contains the values</param> /// <param name="ASituation">The current report situation</param> /// <returns>true</returns> private bool InsertDataRow(int ANumColumns, int AChildRow, DataRow ADataRow, ref TRptSituation ASituation) { TVariant[] Header = new TVariant[ANumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[ANumColumns]; for (int Counter = 0; Counter < ANumColumns; ++Counter) { Columns[Counter] = new TVariant(ADataRow[Counter * 2].ToString() + ADataRow[Counter * 2 + 1].ToString()); Header[Counter] = new TVariant(); } ASituation.GetResults().AddRow(0, AChildRow, true, 2, "", "", false, Header, Description, Columns); return true; }
/// <summary> /// Insert the values of the detail data row if we have "Detail" as report level. /// The detail row contains for each partner the room bookings. /// </summary> /// <param name="ANumColumns">Number of columns the report has</param> /// <param name="AChildRow">Index of the child row</param> /// <param name="ARoomName">The room name of which to add the details to the table</param> /// <param name="ASituation">The current report situation</param> /// <returns>true</returns> private bool InsertDetailDataRow(int ANumColumns, ref int AChildRow, string ARoomName, ref TRptSituation ASituation) { foreach (DataRow DetailRow in FAccommodationDetailTable.Rows) { if (DetailRow["RoomName"].ToString() != ARoomName) { continue; } TVariant[] Header = new TVariant[ANumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[ANumColumns]; for (int Counter = 0; Counter < ANumColumns; ++Counter) { Columns[Counter] = new TVariant(DetailRow[Counter].ToString()); Header[Counter] = new TVariant(); } ASituation.GetResults().AddRow(0, AChildRow++, true, 2, "", "", false, Header, Description, Columns); } return true; }
/// <summary> /// Transfers the result of the accommodation table to the report results /// </summary> /// <param name="ADetailLevel">Indicator if we have a brief, full or detail accommodation report</param> /// <param name="ASituation">The current report situation</param> /// <returns>true</returns> public bool FinishAccomTable(String ADetailLevel, ref TRptSituation ASituation) { ASituation.GetResults().Clear(); if (FAccommodationTable == null) { return false; } int ChildRow = 1; int NumColumns = FAccommodationTable.Columns.Count / 2; if (ADetailLevel == "Detail") { // Don't show the cost column if we have a detailed report NumColumns--; } String PreviousVenueName = ""; DataRow[] SortedRows = FAccommodationTable.Select("", "Venue DESC"); foreach (DataRow CurrentRow in SortedRows) { if (CurrentRow[0].ToString() == NO_ACCOMMODATION) { // ignore the row with no accomodation here continue; } if (CurrentRow["Venue"].ToString() != PreviousVenueName) { PreviousVenueName = (String)CurrentRow["Venue"]; if (ChildRow > 1) { InsertEmptyRow(NumColumns, ChildRow++, "", ref ASituation); } InsertEmptyRow(NumColumns, ChildRow++, PreviousVenueName, ref ASituation); } InsertDataRow(NumColumns, ChildRow++, CurrentRow, ref ASituation); if (ADetailLevel == "Detail") { InsertDetailDataRow(NumColumns, ref ChildRow, CurrentRow["RoomName"].ToString(), ref ASituation); } } InsertEmptyRow(NumColumns, ChildRow++, "", ref ASituation); foreach (DataRow CurrentRow in FAccommodationTable.Rows) { if (CurrentRow[0].ToString() != NO_ACCOMMODATION) { continue; } InsertDataRow(NumColumns, ChildRow++, CurrentRow, ref ASituation); break; } if (ADetailLevel == "Full") { InsertEmptyRow(NumColumns, ChildRow++, "", ref ASituation); TVariant[] Header = new TVariant[NumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[NumColumns]; for (int Counter = 0; Counter < NumColumns; ++Counter) { Columns[Counter] = new TVariant(); Header[Counter] = new TVariant(); } Columns[0] = new TVariant(""); Columns[1] = new TVariant("People with accommodation not allocated for their actual time at the conference:"); ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, Header, Description, Columns); foreach (String NoAccom in FNoAccommodationList) { Header = new TVariant[NumColumns]; Description[0] = new TVariant(); Description[1] = new TVariant(); Columns = new TVariant[NumColumns]; for (int Counter = 0; Counter < NumColumns; ++Counter) { Columns[Counter] = new TVariant(); Header[Counter] = new TVariant(); } Columns[0] = new TVariant(""); Columns[1] = new TVariant(NoAccom); ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, Header, Description, Columns); } } else if (ADetailLevel == "Detail") { InsertDetailDataRow(NumColumns, ref ChildRow, NO_ACCOMMODATION, ref ASituation); } return true; }
/// <summary> /// Insert an empty row into the report results /// </summary> /// <param name="ANumColumns">Number of columns the report has</param> /// <param name="AChildRow">The child row index</param> /// <param name="AVenueName">The first column entry</param> /// <param name="ASituation">The current report situation</param> /// <returns>true</returns> private bool InsertEmptyRow(int ANumColumns, int AChildRow, String AVenueName, ref TRptSituation ASituation) { TVariant[] Header = new TVariant[ANumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[ANumColumns]; for (int Counter = 0; Counter < ANumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Columns[0] = new TVariant(AVenueName); ASituation.GetResults().AddRow(0, AChildRow, true, 2, "", "", false, Header, Description, Columns); return true; }
/// <summary> /// Add the extra cost lines for the attendees to the report /// </summary> /// <param name="ASituation"></param> /// <param name="AConferenceKey"></param> /// <param name="APartnerKey"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <returns></returns> private int AddExtraCostLines(ref TRptSituation ASituation, long AConferenceKey, long APartnerKey, int AMasterRow, int ALevel, int AChildRow) { int NumLinesAdded = 0; PcExtraCostTable ExtraCostTable; ExtraCostTable = PcExtraCostAccess.LoadViaPcAttendee(AConferenceKey, APartnerKey, ASituation.GetDatabaseConnection().Transaction); TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; foreach (PcExtraCostRow ExtraCostRow in ExtraCostTable.Rows) { for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); if (NumLinesAdded == 0) { Columns[0] = new TVariant("Extra Cost:"); } Columns[1] = new TVariant(ExtraCostRow.CostTypeCode); // we need one space after the amount. Otherwise it's not correctly printed in the report Columns[2] = new TVariant(StringHelper.FormatUsingCurrencyCode(ExtraCostRow.CostAmount, FConferenceCurrency)); Columns[3] = new TVariant(ExtraCostRow.Comment); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); ++NumLinesAdded; } return NumLinesAdded; }
/// <summary> /// Copies the result of the FAgeTable to report. /// </summary> /// <returns></returns> public bool FinishAgeTable(ref TRptSituation ASituation) { ASituation.GetResults().Clear(); if (FAgeTable == null) { return false; } int ChildRow = 1; foreach (DataRow CurrentRow in FAgeTable.Rows) { TVariant[] Header = new TVariant[5]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[5]; for (int Counter = 0; Counter < 5; ++Counter) { Columns[Counter] = new TVariant(CurrentRow[Counter].ToString()); Header[Counter] = new TVariant(); } ASituation.GetResults().AddRow(0, ChildRow++, true, 2, "", "", false, Header, Description, Columns); } TVariant[] LastHeader = new TVariant[5]; TVariant[] LastDescription = { new TVariant(), new TVariant() }; TVariant[] LastColumns = new TVariant[5]; for (int Counter = 0; Counter < 5; ++Counter) { LastColumns[Counter] = new TVariant(" "); LastHeader[Counter] = new TVariant(); } ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, LastHeader, LastDescription, LastColumns); LastColumns[0] = new TVariant("Youngest person was born on: " + FLatestBirthday.ToString("dd-MMM-yyyy")); ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, LastHeader, LastDescription, LastColumns); LastColumns[0] = new TVariant(" "); ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, LastHeader, LastDescription, LastColumns); LastColumns[0] = new TVariant("Oldest person was born on: " + FEarliestBirthday.ToString("dd-MMM-yyyy")); ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, LastHeader, LastDescription, LastColumns); return true; }
/// <summary> /// Prints the text of the financial sign off lines to the report /// </summary> /// <param name="ASituation"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <param name="AFieldName"></param> /// <returns></returns> private bool AddFinancialSignOffLines(ref TRptSituation ASituation, int AMasterRow, int ALevel, int AChildRow, String AFieldName) { // 1. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } // 2. line // Get the total amount Char RowType = 'T'; int TotalRowIndex = GetResultTableRowIndex(AFieldName, ref RowType, 0, ref ASituation); decimal TotalFees = (decimal)FResultDataTable.Rows[TotalRowIndex]["Total Fees"]; Columns[0] = new TVariant("I agree that the above attendances are accurate. Any differences over the amount"); Columns[4] = new TVariant("Total amount due from Field:"); Columns[5] = new TVariant(FConferenceCurrency + "....." + StringHelper.FormatUsingCurrencyCode(TotalFees, FConferenceCurrency)); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 3. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("payable/receivable are to be discussed with the Conference Office."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 4. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 5. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("Registrar"); Columns[1] = new TVariant("(signed)_________________"); Columns[2] = new TVariant("Date:____________________"); Columns[3] = new TVariant(" "); Columns[4] = new TVariant("1)........................................................"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 6. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 7. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("Field/Office Representative"); Columns[1] = new TVariant("(name)__________________"); Columns[4] = new TVariant("2)........................................................"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 8. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 9. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[1] = new TVariant("(signed)_________________"); Columns[2] = new TVariant("Date:____________________"); Columns[4] = new TVariant("3)........................................................"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 10. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 11. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("Finance Manager"); Columns[1] = new TVariant("(signed)_________________"); Columns[2] = new TVariant("Date:____________________"); Columns[4] = new TVariant("4)........................................................"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 12. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 13. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("Field/Office Representative"); Columns[1] = new TVariant("(name)__________________"); Columns[2] = new TVariant("Date:____________________"); Columns[4] = new TVariant("5)........................................................"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 14. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 15. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[1] = new TVariant("(signed)_________________"); Columns[2] = new TVariant("Date:____________________"); Columns[4] = new TVariant("Less cash already paid by Field:"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 16. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 17. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("NOTE: If this sheet is not signed and returned before leaving the conference"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 18. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant(" the Conference computer records will be deemed as correct."); Columns[4] = new TVariant("Balance due from Field:"); Columns[5] = new TVariant(FConferenceCurrency + ".........................."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 19. 20. 21. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); return true; }
/// <summary> /// Prints the text for the attendee sign off line to the report. /// </summary> /// <param name="ASituation"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <param name="FieldName"></param> /// <returns></returns> private bool AddAttendanceSignOffLines(ref TRptSituation ASituation, int AMasterRow, int ALevel, int AChildRow, String FieldName) { // 1. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } // 2. line Columns[0] = new TVariant("This report is to enable us to establish the correct attendance at the conference"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 3. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("A separate bill with full financial information will be given to the"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 4. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("fields responsible for pqyment of conference fees."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 5. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 6. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("Registrar"); Columns[1] = new TVariant("(signed)_________________"); Columns[2] = new TVariant("Date:____________________"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 7. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 8. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("Field/Office Representative"); Columns[1] = new TVariant("(name)__________________"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 9. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 10. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[1] = new TVariant("(signed)_________________"); Columns[2] = new TVariant("Date:____________________"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 11. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); // 12. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant("NOTE: If this sheet is not signed and returned before leaving the conference"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 13. line for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Description[0] = new TVariant(); Description[1] = new TVariant(); Columns[0] = new TVariant(" the Conference computer records will be deemed as correct."); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); // 14. 15. 16. line AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); return true; }
/// <summary> /// Adds the header row of the financial lines to the report /// </summary> /// <param name="ASituation"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <returns></returns> private bool AddFinancialHeaderRowToResults(ref TRptSituation ASituation, int AMasterRow, int ALevel, int AChildRow) { TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Columns[1] = new TVariant("Conf. Disc."); Columns[2] = new TVariant("Accom. Disc."); Columns[3] = new TVariant("Cong. Vol."); Columns[4] = new TVariant("Cong. Sp.Role"); Columns[5] = new TVariant("Cong. Only"); Columns[6] = new TVariant("Total"); Columns[7] = new TVariant("Campgn Only"); Columns[8] = new TVariant("Conf. Fees"); Columns[9] = new TVariant("Outreach Fees"); Columns[10] = new TVariant("Supplement"); Columns[11] = new TVariant("Extra Costs"); Columns[12] = new TVariant("Accommodation"); Columns[13] = new TVariant("Total Fees"); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow, Columns); return true; }
/// <summary> /// Adds one row for the financial lines from the FResult data table to the report /// </summary> /// <param name="AResultRow"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <param name="ASituation"></param> /// <returns></returns> private bool AddFinancialRowToResults(DataRow AResultRow, int AMasterRow, int ALevel, int AChildRow, ref TRptSituation ASituation) { TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Columns[0] = new TVariant(MakeFirstColumnEntry(AResultRow)); Columns[1] = new TVariant(AResultRow["Conference Discount"]); Columns[2] = new TVariant(AResultRow["Accommodation Discount"]); Columns[3] = new TVariant(AResultRow["Congress Volunteer"]); Columns[4] = new TVariant(AResultRow["Congress Special Role"]); Columns[5] = new TVariant(AResultRow["Congress Only"]); Columns[6] = new TVariant(AResultRow["Total"]); Columns[7] = new TVariant(AResultRow["Outreach Only"]); Columns[8] = new TVariant(AResultRow["Conference Fees"]); Columns[9] = new TVariant(AResultRow["Outreach Fees"]); Columns[10] = new TVariant(AResultRow["Supplement"]); Columns[11] = new TVariant(AResultRow["Extra Costs"]); Columns[12] = new TVariant(AResultRow["Accommodation"]); Columns[13] = new TVariant(AResultRow["Total Fees"]); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow, Columns); return true; }
/// <summary> /// Adds an empty row to the report /// </summary> /// <param name="ASituation"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <returns></returns> private bool AddEmptyRowToResults(ref TRptSituation ASituation, int AMasterRow, int ALevel, int AChildRow) { TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow, Columns); return true; }
/// <summary> /// Add one line with the field name to the report. /// </summary> /// <param name="AFieldName"></param> /// <param name="AMasterRow"></param> /// <param name="ALevel"></param> /// <param name="AChildRow"></param> /// <param name="ASituation"></param> /// <returns></returns> private bool AddNewFieldNameToResults(String AFieldName, int AMasterRow, int ALevel, int AChildRow, ref TRptSituation ASituation) { AddEmptyRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); TVariant[] Header = new TVariant[FMaxNumColumns]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[FMaxNumColumns]; for (int Counter = 0; Counter < FMaxNumColumns; ++Counter) { Columns[Counter] = new TVariant(" "); Header[Counter] = new TVariant(); } Columns[0] = new TVariant(AFieldName); ASituation.GetResults().AddRow(AMasterRow, AChildRow, true, ALevel, "", "", false, Header, Description, Columns); ASituation.GetResults().UpdateRow(AMasterRow, AChildRow++, Columns); AddFinancialHeaderRowToResults(ref ASituation, AMasterRow, ALevel, AChildRow++); return true; }
/// <summary> /// Copies the result of the FConferenceRoleTable to report. /// </summary> /// <param name="ASelectedOutreachOptions">csv list of the selected outreach options</param> /// <param name="ASituation">current report situation</param> /// <returns></returns> public bool FinishConferenceRoleTable(String ASelectedOutreachOptions, ref TRptSituation ASituation) { ASituation.GetResults().Clear(); if (FConferenceRoleTable == null) { return false; } DataTable ResultTable = MakeResultTable(ASelectedOutreachOptions); int ChildRow = 1; int[] Totals = new int[] { 0, 0, 0, 0, 0, 0 }; foreach (DataRow CurrentRow in ResultTable.Rows) { TVariant[] Header = new TVariant[6]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[6]; for (int Counter = 0; Counter < 6; ++Counter) { Columns[Counter] = new TVariant(CurrentRow[Counter].ToString()); Header[Counter] = new TVariant(); if (Counter > 0) { Totals[Counter] = Totals[Counter] + (int)CurrentRow[Counter]; } } ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, Header, Description, Columns); } // Add empty Row TVariant[] LastHeader = new TVariant[6]; TVariant[] LastDescription = { new TVariant(), new TVariant() }; TVariant[] LastColumns = new TVariant[6]; for (int Counter = 0; Counter < 6; ++Counter) { LastColumns[Counter] = new TVariant(" "); LastHeader[Counter] = new TVariant(); } ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, LastHeader, LastDescription, LastColumns); // Add Total Row LastColumns[0] = new TVariant("Total"); for (int Counter = 1; Counter < 6; ++Counter) { LastColumns[Counter] = new TVariant(Totals[Counter]); } ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, LastHeader, LastDescription, LastColumns); return true; }
/// <summary> /// Copies the result of the FNationalityTable to report. /// </summary> /// <returns></returns> public bool FinishNationalityTable(ref TRptSituation ASituation) { ASituation.GetResults().Clear(); if (FNationalityTable == null) { return false; } int ChildRow = 1; foreach (DataRow CurrentRow in FNationalityTable.Rows) { String NationalityCode = (String)CurrentRow[COLUMNNATIONALITYCODE]; CurrentRow[COLUMNNATIONALITY] = NationalityCode; // + " " + GetCountryName(NationalityCode, ref ASituation); TVariant[] Header = new TVariant[6]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[6]; for (int Counter = 0; Counter < 5; ++Counter) { Columns[Counter] = new TVariant(CurrentRow[Counter].ToString()); Header[Counter] = new TVariant(); } Columns[5] = new TVariant(GetLanguagesSummary(NationalityCode)); Header[5] = new TVariant(); ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, Header, Description, Columns); } return true; }
/// <summary> /// Copies the result of the FAttendanceTable to report. /// </summary> /// <returns></returns> public bool FinishAttendanceTable(ref TRptSituation ASituation) { ASituation.GetResults().Clear(); if (FAttendanceTable == null) { return false; } int ChildRow = 1; foreach (DataRow CurrentRow in FAttendanceTable.Rows) { if (!(bool)CurrentRow[5]) { // skip dates where there is no entry. continue; } TVariant[] Header = new TVariant[5]; TVariant[] Description = { new TVariant(), new TVariant() }; TVariant[] Columns = new TVariant[5]; for (int Counter = 0; Counter < 5; ++Counter) { Columns[Counter] = new TVariant(CurrentRow[Counter].ToString()); Header[Counter] = new TVariant(); } ASituation.GetResults().AddRow(0, ChildRow++, true, 1, "", "", false, Header, Description, Columns); } return true; }