Exemplo n.º 1
0
        public void InstantiateIn(Control container)
        {
            try
            {
                CffGridView dGrid;
                if (this.dataSource != null)
                {
                    detailGridView.DataSource = this.dataSource;
                    detailGridView.DataBind();

                    dGrid = ((Cff.SaferTrader.Web.UserControls.CffGridView)(((DevExpress.Web.ASPxGridView.GridViewBaseTemplateContainer)(((DevExpress.Web.ASPxGridView.GridViewDetailRowTemplateContainer)container))).Grid));
                    dGrid.FocusedRowIndex = this.currentRow;
                    dGrid.DetailGridID    = ((DevExpress.Web.ASPxGridView.GridViewDetailRowTemplateContainer)container).ID;
                    this.ID = ((DevExpress.Web.ASPxGridView.GridViewDetailRowTemplateContainer)container).ID;
                    dGrid.FindDetailRowTemplateControl(dGrid.FocusedRowIndex, this.ID);
                    container.Controls.Add(detailGridView);
                }
                else
                {
                    dGrid           = ((Cff.SaferTrader.Web.UserControls.CffGridView)(((DevExpress.Web.ASPxGridView.GridViewBaseTemplateContainer)(((DevExpress.Web.ASPxGridView.GridViewDetailRowTemplateContainer)container))).Grid));
                    this.currentRow = dGrid.CurrentFocusedRow;
                }
            }
            catch { }

            //detailGridView.BeforePerformDataSelect += new EventHandler(detailGridView_BeforePerformDataSelect);
            //detailGridView.DataBinding += new EventHandler(detailGridView_DataBinding);
            //detailGridView.DataBound += new EventHandler(detailGridView_DataBound);
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 3
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);
            }
        }