public void Display(AgedBalancesReport report)
        {
            ViewState.Add("AgedBalancesReport", report);
            if (report != null)
            {
                if (this.isReportWithNotes)
                {
                }
                else
                {
                    reportGridView.DataSource = report.Records;
                    reportGridView.DataBind();

                    if (reportGridView.AllowSorting)
                    {
                        reportGridView.Sort("CustomerName", SortDirection.Ascending);
                    }
                }
            }
        }
Beispiel #2
0
        public void Display(AgedBalancesReport report)
        {
            if (report != null)
            {
                ViewState.Add("AgedBalancesReport", report);
                reportGridView.DataSource = report.Records;
                if (IsReportWithNotesLiteral.Text.ToLower().Trim() == "true" || isReportWithNotes)
                {
                    reportGridView.Templates.DetailRow              = new AgedBalancesNotesDetailRowTemplate("Created");
                    reportGridView.SettingsDetail.ShowDetailRow     = true;
                    reportGridView.SettingsDetail.ShowDetailButtons = true;
                    //reportGridView.SettingsDetail.AllowOnlyOneMasterRowExpanded = false;
                }
                else
                {
                    reportGridView.SettingsDetail.ShowDetailRow     = false;
                    reportGridView.SettingsDetail.ShowDetailButtons = false;
                }

                reportGridView.DataBind();
                DateViewedLiteral.Text = report.DateViewed.ToDateTimeString();
            }
        }
        public override void Export()
        {
            AgedBalancesReport report = ViewState["AgedBalancesReport"] as AgedBalancesReport;

            System.Collections.Generic.IList <AgedBalancesReportRecord> exportRecordWithNotes = new System.Collections.Generic.List <AgedBalancesReportRecord>();

            foreach (AgedBalancesReportRecord rptRecord in report.Records)
            {
                System.Collections.Generic.IList <CustomerNote> cnList = rptRecord.CustNoteList;
                rptRecord.Note = "";
                foreach (CustomerNote cNote in cnList)
                {
                    if (!string.IsNullOrEmpty(cNote.Comment))
                    {
                        rptRecord.Note += "[" + cNote.CreatedByEmployeeName + "][" + cNote.Created.ToShortDateString() + "]";
                        rptRecord.Note += cNote.Comment + System.Environment.NewLine;
                    }
                }

                if (!string.IsNullOrEmpty(rptRecord.Note))
                {
                    rptRecord.CustNoteList.Clear();
                }

                exportRecordWithNotes.Add(rptRecord);
            }

            //init columns
            CffGenGridView exportGrid = this.reportGridView;

            if (this.isReportWithNotes)
            {
                exportGrid.AllowSorting      = true;
                exportGrid.SetSortExpression = "CustomerName";
                exportGrid.InsertDataColumn("Customer", "CustomerName");
                exportGrid.InsertCurrencyColumn("Current", "CurrentBalance");
                exportGrid.InsertCurrencyColumn("Month 1", "MonthOldBalance");
                exportGrid.InsertCurrencyColumn("Month 2", "TwoMonthsOldBalance");
                exportGrid.InsertCurrencyColumn("Month 3+", "ThreeMonthsOrOlderBalance");
                exportGrid.InsertCurrencyColumn("Balance", "Balance");
                exportGrid.InsertDataColumn("Next Call", "NextCallDate", CffGridViewColumnType.Date, "10%", "cffGGV_centerAlignedCell", HorizontalAlign.Center, HorizontalAlign.Center, true);
                exportGrid.InsertDataColumn("Note", "Note");
                exportGrid.Visible = false;

                exportGrid.InsertDataColumn("Email", "Email");
                exportGrid.InsertDataColumn("Contact", "Contact");
                exportGrid.InsertDataColumn("Phone", "Phone");
                exportGrid.InsertDataColumn("Mobile Phone", "Cell");
                exportGrid.TotalsSummarySettings.SetColumnTotals("CurrentBalance, MonthOldBalance, TwoMonthsOldBalance, ThreeMonthsOrOlderBalance, Balance");
                exportGrid.CustomFooterSettings = CffCustomFooterMode.ShowTotals | CffCustomFooterMode.DefaultSettings;

                exportGrid.DataSource = exportRecordWithNotes;
                exportGrid.DataBind();
            }


            if (report != null)
            {
                ExcelDocument document = new ExcelDocument();
                document._HSFFGetSheet.SetColumnWidth(8, 400);
                document.WriteTitle(report.Title);

                if (IsReportWithNotesLiteral.Text.ToLower() == "true")
                {
                    exportGrid.WriteToExcelDocument(document);
                }
                else
                {
                    reportGridView.WriteToExcelDocument(document);
                }

                document.MoveToNextRow();
                document.MoveToNextRow();
                document.AddCell("Date Viewed");
                document.AddCell(report.DateViewed.ToDateTimeString());

                WriteToResponse(document.WriteToStream(), report.ExportFileName);
            }
        }
Beispiel #4
0
        public override void Export()
        {
            AgedBalancesReport report = ViewState["AgedBalancesReport"] as AgedBalancesReport;

            System.Collections.Generic.IList <AgedBalancesReportRecord> exportRecordWithNotes = new System.Collections.Generic.List <AgedBalancesReportRecord>();

            foreach (AgedBalancesReportRecord rptRecord in report.Records)
            {
                System.Collections.Generic.IList <CustomerNote> cnList = rptRecord.CustNoteList;
                rptRecord.Note = "";
                foreach (CustomerNote cNote in cnList)
                {
                    if (!string.IsNullOrEmpty(cNote.Comment))
                    {
                        rptRecord.Note += "[" + cNote.CreatedByEmployeeName + "][" + cNote.Created.ToShortDateString() + "]";
                        rptRecord.Note += cNote.Comment + System.Environment.NewLine;
                    }
                }

                if (!string.IsNullOrEmpty(rptRecord.Note))
                {
                    rptRecord.CustNoteList.Clear();
                }

                exportRecordWithNotes.Add(rptRecord);
            }

            //init columns
            CffGridView exportGrid = new CffGridView(250);

            if (IsReportWithNotesLiteral.Text.ToLower() == "true")
            {
                exportGrid.SettingsBehavior.AllowSort = true;
                exportGrid.InsertRightAlignedDataColumn("CustomerNumber", "#");
                exportGrid.InsertHyperlinkColumn("CustomerName", "Customer", "Id", LinkHelper.NavigateUrlFormatToDashboardForCustomer);
                exportGrid.InsertCurrencyColumn("CurrentBalance", "Current");
                exportGrid.InsertCurrencyColumn("MonthOldBalance", "Month 1");
                exportGrid.InsertCurrencyColumn("TwoMonthsOldBalance", "Month 2");
                exportGrid.InsertCurrencyColumn("ThreeMonthsOrOlderBalance", "Month 3+");
                exportGrid.InsertCurrencyColumn("Balance");
                exportGrid.InsertDataColumn("NextCallDate", "Next Call");
                exportGrid.InsertMemoColumn("Note", "Note");
                exportGrid.Visible = false;

                exportGrid.InsertDataColumn("Email");
                exportGrid.InsertDataColumn("Contact");
                exportGrid.InsertDataColumn("Phone");
                exportGrid.InsertDataColumn("Cell", "Mobile Phone");

                exportGrid.TotalSummary.Clear();
                exportGrid.InsertTotalSummaryLabelColumn(0);
                exportGrid.InsertTotalSummarySumColumn("CurrentBalance");
                exportGrid.InsertTotalSummarySumColumn("MonthOldBalance");
                exportGrid.InsertTotalSummarySumColumn("TwoMonthsOldBalance");
                exportGrid.InsertTotalSummarySumColumn("ThreeMonthsOrOlderBalance");
                exportGrid.InsertTotalSummarySumColumn("Balance");

                exportGrid.DataSource = exportRecordWithNotes;
                exportGrid.DataBind();
            }



            if (report != null)
            {
                ExcelDocument document = new ExcelDocument();
                document.HSFFGetSheet.SetColumnWidth(8, 400);
                document.WriteTitle(report.Title);

                Hashtable hashtable = new Hashtable();
                hashtable.Add("Client", "ClientName");
                hashtable.Add("Customer", "CustomerName");

                if (IsReportWithNotesLiteral.Text.ToLower() == "true")
                {
                    exportGrid.WriteToExcelDocumentWithReplaceField(document, hashtable);
                }
                else
                {
                    reportGridView.WriteToExcelDocumentWithReplaceField(document, hashtable);
                }

                document.MoveToNextRow();
                document.MoveToNextRow();
                document.AddCell("Date Viewed");
                document.AddCell(report.DateViewed.ToDateTimeString());

                WriteToResponse(document.WriteToStream(), report.ExportFileName);
            }
        }