public PianoRatealeSubreport(IList<ReportRataSoggettoDTO> dataSource, CondominioDTO condominio, EsercizioDTO esercizio, PianoRatealeReportParameters parameters, ImpostazioneReportDTO impostazioneReportDTO, decimal importoTotale) : base(condominio, esercizio, null ,null, false, true) { _impostazioneReportDTO = impostazioneReportDTO; base.Inizializza(impostazioneReportDTO, parameters.Note); if (impostazioneReportDTO.MultiPage) { var helper = new PianoRatealeHelper(dataSource, impostazioneReportDTO); var columns = helper.GetColumnList(null, null, null, null); var pagine = columns.Select(item => item.PrintPage).Distinct().ToList(); _mergeReports = new List<PianoRatealeSinglePage>(pagine.Count); foreach (var i in pagine) { var columnsPage = columns.Where(item => item.PrintPage == i).Select(item => item.Order); var dataSourcePage = dataSource.Where(item => (item.NumeroRata == 0 && item.NumeroRata == 0) || columnsPage.Contains(item.NumeroRata)).ToList(); var pageReport = new PianoRatealeSinglePage(dataSourcePage, condominio, esercizio, parameters, impostazioneReportDTO, importoTotale, i, true); _mergeReports.Add(pageReport); pageReport.CreateDocument(impostazioneReportDTO); } _reportMerge = _report; _reportMerge.BeforePrint += XtraReportMerged_BeforePrint; } else { var riparto = new PianoRatealeSinglePage(dataSource, condominio, esercizio, parameters, impostazioneReportDTO, importoTotale, null, false); var report = riparto.GetReport(); _reportMerge = report; }}
public override void SetData(XtraReport report, string url) { // Change Report Display Name when Saving. So users know what file each report tab represents report.DisplayName = Path.GetFileNameWithoutExtension(url); base.SetData(report, url); }
public void SaveReport(XtraReport report) { XafReport xafReport = report as XafReport; if(xafReport == null) { throw new ArgumentException("XafReport is expected", "report"); } XafReportSerializationHelper.SaveReport(this, xafReport); }
public void PrintDialog(string operation) { if (string.IsNullOrEmpty(biEditTemplet.Caption)) { MessageBox.Show(@"请先在 维护中心-模板管理,添加仓位标签项,再打开此界面!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var dt = new DataKis.StockPlacePrintDataTable(); foreach (var uRow in uGridCheck.Rows.GetFilteredInNonGroupByRows()) { var nRow = dt.NewStockPlacePrintRow(); nRow.FSPID = int.Parse(uRow.Cells["FSPID"].Value.ToString()); nRow.FNumber = uRow.Cells["FNumber"].Value.ToString(); nRow.FName = uRow.Cells["FName"].Value.ToString(); nRow.FFullName = uRow.Cells["FFullName"].Value.ToString(); dt.Rows.Add(nRow); } if (dt.Rows.Count < 1) { MessageBox.Show(@"请先筛选要打印的数据!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.PrinterName = _cPrinter; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 xtreport.DataSource = dt; //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
public void Assign(XtraReport report, XRTable captionTable, XRTable dataTable) { DetachEvents(); _report = report; _captionTable = captionTable; SetCaptions(); _dataTable = dataTable; WireUpEvents(); // if(ManualFill && ! ManualFillOnly) { XRTableRow dataRow = _dataTable.Rows.FirstRow; _dataTable.InsertRowBelow(dataRow); XRTableRow manualFillRow = _dataTable.Rows[1]; // set tags for cells 1 - 7 (days of week, first cell is name) for(int idx = 0; idx < manualFillRow.Cells.Count; idx++) { if (idx>0 && idx<=7) { manualFillRow.Cells[idx].Tag = dataRow.Cells[idx].Tag; manualFillRow.Cells[idx].BeforePrint += PrintManualFillCell; } manualFillRow.Cells[idx].Borders = dataRow.Cells[idx].Borders; manualFillRow.Cells[idx].Font = dataRow.Cells[idx].Font; } if(!HideSums) { manualFillRow.Cells[8].BackColor = Color.Black; } } }
public override void SaveReport(XtraReport report) { base.SaveReport(report); CustomXafReport xafReport = (CustomXafReport)report; this.ReportId = xafReport.ReportId; this.ReportName = xafReport.ReportName; }
public void Should_print_multiple_times_with_actions_firing_correct_count() { var counter = 0; var report = new XtraReport(); report.Bands.Add(new DetailBand()); report.Bands[0].Controls.Add(new XRLine()); var facade = new ReportControlActionFacade(ReportControlAction<XRLine>.WithNoPredicate(l => { l.ForeColor = Color.Blue; counter++; })); var controller = new ReportController(new EventAggregator(), report,facade); var newReport1 = controller.Print(r => r.ExportToMemory()); var newReport2 = controller.Print(r => r.ExportToMemory()); newReport1.Bands[0].Controls[0].ForeColor.Should().Be(Color.Blue,"Action should have been applied to control"); newReport2.Bands[0].Controls[0].ForeColor.Should().Be(Color.Blue, "Action should have been applied to control"); counter.Should().Be(2,"Action should only have fired once for each time"); }
public static void PopulateHeaderLabels(XtraReport report, params string[] captions) { var pageHeaderBand = report.FindControl(ReportHeaderBandName, true); if (pageHeaderBand != null) { var header = pageHeaderBand.Controls.OfType<XRLabel>().FirstOrDefault(label => label.Name == ReportNameLabel); if (header != null) { header.CanShrink = true; header.Text = captions[0]; } header = pageHeaderBand.Controls.OfType<XRLabel>().FirstOrDefault(label => label.Name == DataFilterLabel); if (header != null) { string caption = (String.IsNullOrEmpty(captions[1]) == false) ? String.Format("({0})", captions[1]) : String.Empty; header.CanShrink = true; header.Text = caption; } header = pageHeaderBand.Controls.OfType<XRLabel>().FirstOrDefault(label => label.Name == GridFilterLabel); if (header != null) { string caption = (String.IsNullOrEmpty(captions[2]) == false) ? String.Format("({0})", captions[2]) : String.Empty; header.CanShrink = true; header.Text = caption; } } }
public void Should_fire_actions_on_table_members() { var transformColor = Color.Blue; var action = new ReportControlAction<XRControl>(c => true, c => c.BackColor = transformColor); var table = new XRTable(); var row = new XRTableRow(); var cell = new XRTableCell(); row.Cells.Add(cell); table.Rows.Add(row); var report = new XtraReport(); report.Bands.Add(new DetailBand()); report.Bands[0].Controls.Add(table); //var subscriber = XRRuntimeSubscriber.SubscribeWithActions(action); var reportb = new ReportController(new EventAggregator(), report, new ReportControlActionFacade(action)).Print(r => r.ExportToMemory()); var tableB = (XRTable)reportb.Bands[0].Controls[0]; var rowB = tableB.Rows[0]; var cellb = rowB.Cells[0]; Assert.AreEqual(transformColor, cellb.BackColor); }
/// <summary> /// Iterates alls XRTableCell and XRLabel cells in the given report /// </summary> /// <param name="report">The report to fix its RTL direction alignment</param> private static void IterateCells(XtraReport report) { // Iterate all XRTableCells and fix them MakeCellsRightToLeft(report, report.AllControls<XRTableCell>()); // Iterate all XRLabels and fix them MakeCellsRightToLeft(report, report.AllControls<XRLabel>()); }
public void GenerateReport(XtraReport r, IList list, Type aType) { r.DataSource = list; InitBands(r); if (list.Count == 0) return; dsd = GenerateDataSourceDefinition(aType); InitDetailsBasedOnXRLabel(r, dsd); }
public void GivenASubreportExistsAsAFile() { _subReportFilePath = Helpers.GetNewTempFile() + ".repx"; Path.GetDirectoryName(_subReportFilePath).Should().NotBeNullOrEmpty(); var subReport = new XtraReport(); subReport.SaveLayout(_subReportFilePath); File.Exists(_subReportFilePath).Should().BeTrue(); }
protected override void OnDisposing() { ViewModel.Reload -= ViewModel_Reload; ViewModel.ReportTypeChanged -= ViewModel_ReportTypeChanged; ViewModel.ReportEntityKeyChanged -= ViewModel_ReportEntityKeyChanged; exportSettingsControl.ExportClick -= exportSettings_Export; previewControl.DocumentSource = null; report = null; base.OnDisposing(); }
protected override void OnDisposing() { ViewModel.Reload -= ViewModel_Reload; ViewModel.ReportTypeChanged -= ViewModel_ReportTypeChanged; ViewModel.ReportEntityKeyChanged -= ViewModel_ReportEntityKeyChanged; previewControl.DocumentSource = null; report = null; ReleaseModuleReports<CustomerReportType>(); base.OnDisposing(); }
public void GivenReportBExistsWithSubreportReportC() { _reportB = new XtraReportWithSubReportInDetailReport(); var band = (DetailReportBand)_reportB.Bands[BandKind.DetailReport]; band.DataMember = "DogToys"; _containerWithReportCInside = (XRSubreport)band.Bands[BandKind.Detail].Controls[0]; _reportC = new XtraReport(); }
public PDFActionResult(XtraReport report) { using (MemoryStream stream = new MemoryStream()) { report.CreateDocument(); report.ExportToPdf(stream); _byteArray = stream.ToArray(); } }
void UpdatePreview() { if(ViewModel.ReportType == SalesReportType.None) return; this.report = CreateAndInitializeReport(ViewModel.ReportType); previewControl.DocumentSource = report; CreateDocument(report); exportSettingsControl.SetSettings(GetSettingsEditor(ViewModel.ReportType)); exportSettingsControl.ExportEnabled = false; }
public void Should_Dispose_visitors() { var view = new XtraReport {DataSource = new[] {new object(), new object()}}; var controllerA = new XRReportController(view); var view2 = controllerA.Print(r => r.ExportToMemory()); GlobalXRSubscriber.Singleton.Visitors.Values.Count(wr => wr.IsAlive && ((XRRuntimeVisitor)wr.Target).ReportHashcode == view2.RootHashCode).Should().Be(1); GC.Collect(); GlobalXRSubscriber.Singleton.Visitors.Values.Count(wr => wr.IsAlive && ((XRRuntimeVisitor)wr.Target).ReportHashcode == view2.RootHashCode).Should().Be(0); }
public XtraReport GenerateReport(IList list, Type aType) { XtraReport r = new XtraReport(); r.DataSource = list; InitBands(r); if (list.Count == 0) return r; dsd = GenerateDataSourceDefinition(aType); InitDetailsBasedOnXRLabel(r, dsd); return r; }
public void Should_apply_actions_to_entire_report() { var color = Color.Green; var action = new ReportControlAction<XtraReport>(r => true, r => r.BackColor = color); var report = new XtraReport(); var newReport = new ReportController(new EventAggregator(), report, new ReportControlActionFacade(action)).Print(r => r.ExportToMemory()); Assert.AreEqual(color, newReport.BackColor); }
public void InitBands(XtraReport rep) { DetailBand detail = new DetailBand(); PageHeaderBand pageHeader = new PageHeaderBand(); ReportFooterBand reportFooter = new ReportFooterBand(); detail.Height = 20; reportFooter.Height = 380; pageHeader.Height = 20; rep.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { detail, pageHeader, reportFooter }); }
public void InvokeAfter(XtraReport report, object customArgs) { report.Disposed += (s, e) => { var rep = (XtraReport)report; var dataSource = report.DataSource as IDisposable; if (dataSource != null) dataSource.Dispose(); report.DataSource = null; }; }
public void SetDataSource(XtraReport document, ImpostazioneReportDTO impostazioneReportDTO) { _document = document; if (_document.Pages.Count == 0) { _document.CreateDocument(); if (impostazioneReportDTO != null && impostazioneReportDTO.FitToPage) _document.PrintingSystem.Document.AutoFitToPagesWidth = 1; } documentViewer1.DocumentSource = _document; }
public void SetTextWatermark(XtraReport report) { // Adjust text watermark settings. report.Watermark.Text = "Not Origional"; report.Watermark.TextDirection = DirectionMode.ForwardDiagonal; report.Watermark.Font = new Font("Arial Black", 50); report.Watermark.ForeColor = Color.DarkRed; report.Watermark.TextTransparency = 60; report.Watermark.ShowBehind = true; //report.Watermark.PageRange = "1,3-5"; }
public XtraReportLoader(XtraReport report, string repxFileName) { if (repxFileName == null) throw new ArgumentNullException("repxFileName"); if (report == null) throw new ArgumentNullException("report"); if (!File.Exists(repxFileName)) throw new IOException(String.Format("File {0} was not found.", repxFileName)); Report = XtraReport.FromFile(repxFileName, true); }
public SelectDesignTimeDataSourceForm(IDesignDataContext context, XtraReport report, IEventAggregator aggregator, IDataSourceTraverser traverser) { InitializeComponent(); _context = context; _report = report; _aggregator = aggregator; _traverser = traverser; iReportDatasourceMetadataBindingSource.DataSource = _context.DesignDataRepository.GetAvailableMetadatas().ToList(); //this.gridControl1.DataSource = bindingSource1.DataSource; }
public FrmInPhieu(Models.HistoryHoiVien hs, bool isGYM) { InitializeComponent(); var hv = hs.HoiVien; rp = new BaoCao(); printControl1.PrintingSystem = rp.PrintingSystem; rp.Parameters["LoaiVe"].Value = isGYM ? "GYM" : "Sauna"; rp.Parameters["ToDay"].Value = DateTimeUtil.dateToString(DateTime.Now); rp.Parameters["TenHoiVien"].Value = hv.TenHoiVien; rp.Parameters["MaGYM"].Value = hv.MaThe; //rp.CreateDocument(); inPhieu(); }
private XtraReport CreateReport() { // Create a blank report. XtraReport crossTabReport = new XtraReport() { VerticalContentSplitting = VerticalContentSplitting.Smart, HorizontalContentSplitting = HorizontalContentSplitting.Smart }; crossTabReport.PaperKind = System.Drawing.Printing.PaperKind.Custom; crossTabReport.Landscape = true; crossTabReport.PageSize = new Size(int.Parse(txtWidth.Text), int.Parse(txtHigh.Text)); crossTabReport.ReportUnit = ReportUnit.TenthsOfAMillimeter; // Create a detail band and add it to the report. DetailBand detail = new DetailBand(); crossTabReport.Bands.Add(detail); // Create a cross tab and add it to the Detail band. XRCrossTab crossTab = new XRCrossTab(); detail.Controls.Add(crossTab); //HACK true to show in all pages crossTab.PrintOptions.RepeatColumnHeaders = false; crossTab.PrintOptions.RepeatRowHeaders = false; crossTabReport.PrintingSystem.Document.AutoFitToPagesWidth = 1; // Create a data source Access97ConnectionParameters connectionParameters = new Access97ConnectionParameters(@"|DataDirectory|\nwind.mdb", "", ""); SqlDataSource ds = new SqlDataSource(connectionParameters); // Create an SQL query to access the SalesPerson view. SelectQuery query = SelectQueryFluentBuilder.AddTable("SalesPerson") .SelectColumn("CategoryName") .SelectColumn("ProductName") .SelectColumn("Country") .SelectColumn("Sales Person") .SelectColumn("Quantity") .SelectColumn("Extended Price").Build("SalesPerson"); ds.Queries.Add(query); // Bind the cross tab to data. crossTab.DataSource = ds; crossTab.DataMember = "SalesPerson"; // Generate cross tab's fields. crossTab.RowFields.Add(new CrossTabRowField() { FieldName = "CategoryName" }); crossTab.RowFields.Add(new CrossTabRowField() { FieldName = "ProductName" }); crossTab.ColumnFields.Add(new CrossTabColumnField() { FieldName = "Country" }); crossTab.ColumnFields.Add(new CrossTabColumnField() { FieldName = "Sales Person" }); crossTab.DataFields.Add(new CrossTabDataField() { FieldName = "Quantity" }); crossTab.DataFields.Add(new CrossTabDataField() { FieldName = "Extended Price" }); crossTab.GenerateLayout(); /* +----------------+---------------+-------------------------------+---------------------------+---------------------------+ | Category Name | Product Name | [Country] | Total [Country] | Grand total | | | +-------------------------------+ | | | | | [Sales Person] | | | | | +------------+------------------+----------+----------------+----------+----------------+ | | | Quantity | Extended Price | Quantity | Extended Price | Quantity | Extended Price | +----------------+---------------+------------+------------------+----------+----------------+----------+----------------+ | [CategoryName] | [ProductName] | [Quantity] | [Extended Price] | | | | | +----------------+---------------+------------+------------------+----------+----------------+----------+----------------+ | Total [CategoryName] | | | | | | | +--------------------------------+------------+------------------+----------+----------------+----------+----------------+ | Grand Total | | | | | | | +--------------------------------+------------+------------------+----------+----------------+----------+----------------+ */ //Adjust generated cells foreach (var c in crossTab.ColumnDefinitions) { //Enable auto-width for all columns //HACK cell auto grow DevExpress.XtraReports.UI.AutoSizeMode.ShrinkAndGrow c.AutoWidthMode = DevExpress.XtraReports.UI.AutoSizeMode.ShrinkAndGrow; } foreach (XRCrossTabCell c in crossTab.Cells) { if (c.DataLevel == 1 && c.RowIndex != 2) { //Adjust format string for the "Extended Price" cells c.TextFormatString = "{0:c}"; } } // Assign styles to cross tab crossTab.CrossTabStyles.GeneralStyle = new XRControlStyle() { Name = "Default", Borders = BorderSide.All, Padding = new PaddingInfo() { All = 2 } }; crossTab.CrossTabStyles.DataAreaStyle = crossTab.CrossTabStyles.TotalAreaStyle = new XRControlStyle() { Name = "Data", TextAlignment = TextAlignment.TopRight }; crossTab.CrossTabStyles.HeaderAreaStyle = new XRControlStyle() { Name = "HeaderAndTotals", BackColor = Color.WhiteSmoke }; return(crossTabReport); }
public static void ExportToMemory(this XtraReport report) { report.ExportToHtml(new MemoryStream()); }
public void InitializeBandsUsingXRTable(XtraReport report) { var ds = (report.DataSource as DataSet); int colCount = ds.Tables[0].Columns.Count; int colWidth = (report.PageWidth - (report.Margins.Left + report.Margins.Right)) / colCount; // Create a table header. var tableHeader = new XRTable(); tableHeader.Height = 20; tableHeader.Width = (report.PageWidth - (report.Margins.Left + report.Margins.Right)); var headerRow = new XRTableRow(); headerRow.Width = tableHeader.Width; tableHeader.Rows.Add(headerRow); tableHeader.BeginInit(); // Create a table body. var tableBody = new XRTable(); tableBody.Height = 20; tableBody.Width = (report.PageWidth - (report.Margins.Left + report.Margins.Right)); var bodyRow = new XRTableRow(); bodyRow.Width = tableBody.Width; tableBody.Rows.Add(bodyRow); tableBody.EvenStyleName = "EvenStyle"; tableBody.OddStyleName = "OddStyle"; tableBody.BeginInit(); // Initialize table header and body cells. for (int i = 0; i < colCount; i++) { var headerCell = new XRTableCell(); headerCell.Width = colWidth; headerCell.Text = ds.Tables[0].Columns[i].Caption; var bodyCell = new XRTableCell(); bodyCell.Width = colWidth; bodyCell.DataBindings.Add("Text", null, ds.Tables[0].Columns[i].Caption); if (i == 0) { headerCell.Borders = BorderSide.Left | BorderSide.Top | BorderSide.Bottom; bodyCell.Borders = BorderSide.Left | BorderSide.Top | BorderSide.Bottom; } else { headerCell.Borders = BorderSide.All; bodyCell.Borders = BorderSide.All; } headerRow.Cells.Add(headerCell); bodyRow.Cells.Add(bodyCell); } tableHeader.EndInit(); tableBody.EndInit(); // Add the table header and body to the corresponding report bands. report.Bands[BandKind.PageHeader].Controls.Add(tableHeader); report.Bands[BandKind.Detail].Controls.Add(tableBody); }
protected virtual void DoPrint() { XtraReport rpt = this.DoPrepareReport(); rpt.Print(); }
public override void SetData(XtraReport report, Stream stream) { report.SaveLayoutToXml(stream); }
private void Form1_Load(object sender, EventArgs e) { XtraReport report = GetReport(); new ReportPrintTool(report).ShowRibbonPreview(); }
private static void InitDataSource(XtraReport report) { report.DataSource = DataSourceInitializer.GetData(); report.DataMember = "TestTable"; }
private void SearchsimpleButton_Click(object sender, EventArgs e) { string AfterStartTime; string AfterEndTime; string NowStartTime; string NowEndTime; int RoomCheck = 0; //勾選數量 bool OddEvenFlag = false; //奇偶數 List <string> RoomName = new List <string>(); //勾選住戶名 List <ElectricTotalPrice> NowbillData = new List <ElectricTotalPrice>(); List <ElectricTotalPrice> AfterbillData = new List <ElectricTotalPrice>(); if (Convert.ToDateTime(StartdateEdit.EditValue).Month == 1) { AfterStartTime = $"{Convert.ToDateTime(StartdateEdit.EditValue).AddYears(-1).Year}1201"; AfterEndTime = $"{Convert.ToDateTime(StartdateEdit.EditValue).AddYears(-1).Year}1231"; } else { AfterStartTime = $"{Convert.ToDateTime(StartdateEdit.EditValue).Year}{Convert.ToDateTime(StartdateEdit.EditValue).AddMonths(-1).Month}01"; AfterEndTime = $"{Convert.ToDateTime(StartdateEdit.EditValue).Year}{Convert.ToDateTime(StartdateEdit.EditValue).AddMonths(-1).Month}{DateTime.DaysInMonth(Convert.ToDateTime(StartdateEdit.EditValue).Year, Convert.ToDateTime(StartdateEdit.EditValue).AddMonths(-1).Month)}"; } NowStartTime = Convert.ToDateTime(StartdateEdit.EditValue).ToString("yyyyMM01"); NowEndTime = Convert.ToDateTime(StartdateEdit.EditValue).ToString("yyyyMM") + DateTime.DaysInMonth(Convert.ToDateTime(StartdateEdit.EditValue).Year, Convert.ToDateTime(StartdateEdit.EditValue).Month); #region 塞入勾選房間房號 foreach (var item in boxItems) { if (item.CheckState == CheckState.Checked) { ElectricConfig electric = (ElectricConfig)item.Tag; RoomName.Add(electric.DeviceName); if (Form1.ConnectionFlag) { var nowbilldata = SqlMethod.Search_ElectricTotalPrice_Billing(NowStartTime, NowEndTime, electric.GatewayIndex, electric.DeviceIndex); NowbillData.Add(nowbilldata); var afterbilldata = SqlMethod.Search_ElectricTotalPrice_Billing(AfterStartTime, AfterEndTime, electric.GatewayIndex, electric.DeviceIndex); AfterbillData.Add(afterbilldata); } else { var nowbilldata = new ElectricTotalPrice() { Price = rnd.Next(500, 1000), KwhTotal = rnd.Next(100, 200) }; NowbillData.Add(nowbilldata); var afterbilldata = new ElectricTotalPrice() { Price = rnd.Next(500, 1000), KwhTotal = rnd.Next(100, 200) }; AfterbillData.Add(afterbilldata); } RoomCheck++; } } #endregion #region 判斷奇數偶數 if (RoomCheck % 2 == 0) { OddEvenFlag = true;//偶數 } else { OddEvenFlag = false;//奇數 } #endregion BillingSheetXtraReport[] billingSheets = new BillingSheetXtraReport[RoomCheck / 2 + RoomCheck % 2]; //計費單數量 XtraReport xtraReport = new XtraReport(); if (OddEvenFlag) //偶數 { for (int i = 0; i < billingSheets.Length; i++) { billingSheets[i] = new BillingSheetXtraReport() { bankAccount = BankaccountSetting }; billingSheets[i].Create_BillingSheet(Convert.ToDateTime(StartdateEdit.EditValue), true, RoomName[i + i], NowbillData[i + i], AfterbillData[i + i], RoomName[i + i + 1], NowbillData[i + i + 1], AfterbillData[i + 1]); billingSheets[i].CreateDocument(); xtraReport.Pages.AddRange(billingSheets[i].Pages); } documentViewer1.DocumentSource = xtraReport; } else//奇數 { for (int i = 0; i < billingSheets.Length; i++) { billingSheets[i] = new BillingSheetXtraReport() { bankAccount = BankaccountSetting }; if (i != billingSheets.Length - 1) { billingSheets[i].Create_BillingSheet(Convert.ToDateTime(StartdateEdit.EditValue), true, RoomName[i + i], NowbillData[i + i], AfterbillData[i + i], RoomName[i + i + 1], NowbillData[i + i + 1], AfterbillData[i + 1]); } else { billingSheets[i].Create_BillingSheet(Convert.ToDateTime(StartdateEdit.EditValue), false, RoomName[i + i], NowbillData[i + i], AfterbillData[i + i]); } billingSheets[i].CreateDocument(); xtraReport.Pages.AddRange(billingSheets[i].Pages); } documentViewer1.DocumentSource = xtraReport; } }
XtraReport CreateReport(string clave) { XtraReport report = null; using (var conexion = new DataModelFE()) { string mensaje = ""; string xml = ""; if (clave.Substring(29, 2) == TipoDocumento.PROFORMA) { WSRecepcionPOSTProforma dato = conexion.WSRecepcionPOSTProforma.Find(clave); if (dato != null) { xml = dato.comprobanteXml; } } else { WSRecepcionPOST dato = conexion.WSRecepcionPOST.Find(clave); if (dato != null) { xml = dato.comprobanteXml; } } //WSRecepcionPOST dato = conexion.WSRecepcionPOST.Where(x => x.clave == clave).FirstOrDefault(); if (!string.IsNullOrWhiteSpace(xml)) { //string xml = EncodeXML.XMLUtils.base64Decode(xml); RptComprobante reportES = new RptComprobante(); RptComprobanteEN reportEN = new RptComprobanteEN(); DocumentoElectronico documento = (DocumentoElectronico)EncodeXML.XMLUtils.getObjetcFromXML(xml); Empresa empresa = conexion.Empresa.Find(documento.emisor.identificacion.numero); if (empresa != null && "EN".Equals(empresa.idioma)) { object dataSource = UtilidadesReporte.cargarObjetoImpresion(documento, mensaje, empresa); reportEN.objectDataSource1.DataSource = dataSource; string enviroment_url = ConfigurationManager.AppSettings["ENVIROMENT_URL"].ToString(); reportEN.xrBarCode1.Text = (enviroment_url + documento.clave).ToUpper(); if (empresa != null && empresa.logo != null) { reportEN.pbLogo.Image = UtilidadesReporte.byteArrayToImage(empresa.logo); } reportEN.CreateDocument(); report = reportEN; } else { if (empresa != null && "ES".Equals(empresa.idioma)) { object dataSource = UtilidadesReporte.cargarObjetoImpresion(documento, mensaje, empresa); reportES.objectDataSource1.DataSource = dataSource; string enviroment_url = ConfigurationManager.AppSettings["ENVIROMENT_URL"].ToString(); reportES.xrBarCode1.Text = (enviroment_url + documento.clave).ToUpper(); if (empresa != null && empresa.logo != null) { reportES.pbLogo.Image = UtilidadesReporte.byteArrayToImage(empresa.logo); } reportES.CreateDocument(); report = reportES; } else { this.alertMessages.Attributes["class"] = "alert alert-danger"; this.alertMessages.InnerText = "El documento ingresado no se encuentra en el repositorio de datos del emisor!!!"; } } this.alertMessages.Attributes["class"] = "alert alert-info"; this.alertMessages.InnerText = "Los datos fueron enviados correctamente!!!"; } else { this.alertMessages.Attributes["class"] = "alert alert-danger"; this.alertMessages.InnerText = "El documento ingresado no se encuentra en el repositorio de datos del emisor!!!"; } } return(report); }
public override string SetNewData(XtraReport report, string defaultUrl) { return(base.SetNewData(report, defaultUrl)); }
void report_DataSourceDemanded(object sender, EventArgs e) { XtraReport report = sender as XtraReport; report.DataSource = GetData(); }
private void CreateDetailBand(XtraReportBase report, DataTable templateTable, String dataMember, Color backColor, bool useStyles) { DetailBand detail = new DetailBand(); report.Bands.Add(detail); detail.HeightF = 0; // Creating Header and Detail Tables XRTable headerTable = new XRTable(); report.Bands[BandKind.ReportHeader].Controls.Add(headerTable); XRTable detailTable = new XRTable(); detail.Controls.Add(detailTable); detailTable.BeginInit(); headerTable.BeginInit(); XRTableRow headerRow = new XRTableRow(); headerTable.Rows.Add(headerRow); XRTableRow detailRow = new XRTableRow(); detailTable.Rows.Add(detailRow); int colCount = templateTable.Columns.Count; XtraReport rootReport = report.RootReport; int pageWidth = (rootReport.PageWidth - (rootReport.Margins.Left + rootReport.Margins.Right)); float colWidth = pageWidth / colCount; //Creating an XRTableCell for each column in the corresponding DataTable for (int i = 0; i < colCount; i++) { XRTableCell headerCell = new XRTableCell(); headerRow.Cells.Add(headerCell); headerCell.WidthF = colWidth; headerCell.Text = templateTable.Columns[i].Caption; headerCell.Borders = DevExpress.XtraPrinting.BorderSide.All; XRTableCell detailCell = new XRTableCell(); detailRow.Cells.Add(detailCell); detailCell.WidthF = colWidth; string actualDM = string.Empty; if (dataMember == string.Empty) { actualDM = templateTable.Columns[i].Caption; } else { actualDM = string.Format("{0}.{1}", dataMember, templateTable.Columns[i].Caption); } detailCell.DataBindings.Add("Text", null, actualDM); detailCell.Borders = DevExpress.XtraPrinting.BorderSide.All; } headerTable.EndInit(); detailTable.EndInit(); headerTable.LocationF = new PointF(0, report.Bands[BandKind.ReportHeader].HeightF); headerTable.WidthF = pageWidth; headerTable.Font = new Font(headerTable.Font, FontStyle.Bold); detailTable.LocationF = new PointF(0, 0); detailTable.WidthF = pageWidth; detailTable.BackColor = backColor; //Applying styles if necessary if (useStyles) { detailTable.EvenStyleName = "EvenStyle"; detailTable.OddStyleName = "OddStyle"; } }
protected BaseMasterDetailReportHelper(XtraReport report, XtraReportBase detailReport = null) : base(report) { this.Report = detailReport ?? report.GetLastDetailReport(); }
protected BaseDetailReportHelper(XtraReport report, string dataMember) : base(report) { this.CreateDetailBandInRootReportIfNotExist(); this.ContainerBand = this.CreateContainerBand(dataMember); }
public static void RunReport(XtraReport report, params IReportRuntimeAction[] action) { var controller = new XRReportController(report, new XRRuntimeActionFacade(action)); controller.Print(r => r.ExportToHtml(new MemoryStream(), new HtmlExportOptions())); }
protected override void FillDataSources(XtraReport report, string reportName, bool isDesignActive) { }
protected virtual void DoPreview() { XtraReport rpt = this.DoPrepareReport(); //准备报表 frmReportPreview.DoPreviewReport(rpt, this); //打开报表预览窗体 }
public override void SetData(XtraReport report, string url) { // Stores the specified report to a Report Storage using the specified URL. // This method is called only after the IsValidUrl and CanSetData methods are called. report.SaveLayoutToXml(Path.Combine(ReportDirectory, $"{url}{FileExtension}")); }
public override void SetData(XtraReport report, string url) { base.SetData(report, url); }
private static void InitExtensions(XtraReport report) { report.Extensions[SerializationService.Guid] = CustomUntypedDataSetSerializer.Name; }
public FrmRaporGoruntule(XtraReport rapor) { InitializeComponent(); documentViewer1.DocumentSource = rapor; }
private void PublishReport(XtraReport report) { ReportPrintTool printTool = new ReportPrintTool(report); printTool.ShowPreviewDialog(); }
private void grdRaporList_ArsDoubleClick(object sender, EventArgs e) { string raporDosyaAdi = grdRaporList.getSelectedRowData("RAPOR_DOSYA_ADI"); string raporAdi = grdRaporList.getSelectedRowData("RAPOR_ADI"); string raporYolu = Path.GetDirectoryName(Application.ExecutablePath) + "\\Raporlar\\" + grdRaporList.getSelectedRowData("RAPOR_ADI") + ".repx"; var filePath = raporYolu; XtraReport report = new XtraReport(); report = XtraReport.FromFile(filePath, true); (report.DataSource as SqlDataSource).ConfigureDataConnection += ConfigureDataConnection; if (report.Parameters.Count > 0 && parentForm != null) { foreach (Parameter parameter in report.Parameters) { foreach (ArsPanel arsPanel in parentForm.arsPanelList) { Control ctrlParam = arsPanel.GetControlByName(parameter.Name); if (ctrlParam != null) { switch (ctrlParam) { case ArsEdit _: switch (parameter.Type.ToString()) { case "System.String": parameter.Value = (ctrlParam as ArsEdit).GetDataStr(); break; case "System.Int32": parameter.Value = Convert.ToInt32((ctrlParam as ArsEdit).GetDataStr()); break; case "System.Double": parameter.Value = Convert.ToDouble((ctrlParam as ArsEdit).GetDataStr()); break; default: parameter.Value = (ctrlParam as ArsEdit).GetDataStr(); break; } break; case ArsMaskEdit _: parameter.Value = (ctrlParam as ArsMaskEdit).GetDataStr(); break; case ArsComboBox _: parameter.Value = (ctrlParam as ArsComboBox).GetString(); break; case ArsCheck _: if (parameter.Type.ToString() == "System.Boolean") { parameter.Value = (ctrlParam as ArsCheck).Checked; } else { if ((ctrlParam as ArsCheck).Checked) { parameter.Value = (ctrlParam as ArsCheck).CheckedValue; } else { parameter.Value = (ctrlParam as ArsCheck).UnCheckedValue; } } break; case ArsDecimalEdit _: parameter.Value = (ctrlParam as ArsDecimalEdit).GetDoubleData(); break; case ArsDateTime _: parameter.Value = (ctrlParam as ArsDateTime).Value; break; } parameter.Visible = false; } } } string folderName = grdRaporList.getSelectedRowData("RAPOR_ADI") + DateTime.Now.Ticks + ".pdf"; var pathFolder = Path.GetDirectoryName(Application.ExecutablePath) + "\\Raporlar\\PDF\\" + folderName; report.ExportToPdf(pathFolder); try { var pathPdf = Path.GetDirectoryName(Application.ExecutablePath) + "\\Raporlar\\PDF\\" + folderName; Process.Start(pathPdf); } catch (Exception ex) { report.ShowRibbonPreview(); } this.Close(); } else { report.ShowRibbonPreview(); this.Close(); } }
public static void PrintPreview(System.Windows.Window win, XtraReport report) { DevExpress.Xpf.Printing.PrintHelper.ShowPrintPreview(win, report); }
public static ReportDesignerViewModel Create(XtraReport report) { return(ViewModelSource.Create(() => new ReportDesignerViewModel(report))); }
protected ReportDesignerViewModel(XtraReport report) { Report = report; }
private XtraReport CreateReport() { XtraReport report1 = new XtraReport(); XtraReport report2 = new XtraReport(); List <XtraReport> oLista = new List <XtraReport>(); XtraReport report = null; var pLista = (List <String>)Session["claves"]; foreach (var item in pLista) { XtraReport reportP = new XtraReport(); using (var conexion = new DataModelFE()) { WSRecepcionPOST dato = conexion.WSRecepcionPOST.Where(x => x.clave == item.ToString()).FirstOrDefault(); string xml = dato.comprobanteXml; RptComprobante reportES = new RptComprobante(); RptComprobanteEN reportEN = new RptComprobanteEN(); DocumentoElectronico documento = (DocumentoElectronico)EncodeXML.XMLUtils.getObjetcFromXML(xml); Empresa empresa = conexion.Empresa.Find(documento.emisor.identificacion.numero); if (empresa != null && "EN".Equals(empresa.idioma)) { object dataSource = UtilidadesReporte.cargarObjetoImpresion(documento, dato.mensaje, empresa); reportEN.objectDataSource1.DataSource = dataSource; string enviroment_url = ConfigurationManager.AppSettings["ENVIROMENT_URL"].ToString(); reportEN.xrBarCode1.Text = (enviroment_url + documento.clave).ToUpper(); if (empresa != null && empresa.logo != null) { reportEN.pbLogo.Image = UtilidadesReporte.byteArrayToImage(empresa.logo); } reportEN.CreateDocument(); reportP = reportEN; } else { object dataSource = UtilidadesReporte.cargarObjetoImpresion(documento, dato.mensaje, empresa); reportES.objectDataSource1.DataSource = dataSource; string enviroment_url = ConfigurationManager.AppSettings["ENVIROMENT_URL"].ToString(); reportES.xrBarCode1.Text = (enviroment_url + documento.clave).ToUpper(); if (empresa != null && empresa.logo != null) { reportES.pbLogo.Image = UtilidadesReporte.byteArrayToImage(empresa.logo); } reportES.CreateDocument(); reportP = reportES; } } oLista.Add(reportP); } if (oLista.Count == 1) { report1 = oLista[0]; } else { if (oLista.Count == 2) { report1 = oLista[0]; report2 = oLista[1]; report1.Pages.AddRange(report2.Pages); report1.PrintingSystem.ContinuousPageNumbering = true; } else { for (int i = 0; i < oLista.Count - 1; i++) { if (i == 0) { report1 = oLista[i]; } else { report1 = report1; } report2 = oLista[i + 1]; report1.Pages.AddRange(report2.Pages); report1.PrintingSystem.ContinuousPageNumbering = true; } } } report = report1; return(report); }
public virtual void Activate() { System.ComponentModel.DXDisplayNameAttribute.UseResourceManager = true; Report = CreateReport(); File.Delete(fileName); }
public override void SetData(XtraReport report, string url) { var reportInfo = _reportGeneratorService.GetReportInfoFromUrl(url); _reportGeneratorService.SaveReportTemplate(reportInfo.CustomerId.Value, reportInfo.PrintType.Value, reportInfo.LanguageId, report); }
public override string SetNewData(XtraReport report, string defaultUrl) { SetData(report, defaultUrl); return(defaultUrl); }
public void AssociateWithReport(IReportDatasourceMetadataWithTraversal definition, XtraReport report) { var hashset = _allItemsDictionary.GetOrCreateValue(report.GetHashCode(), () => new HashSet<IReportDatasourceMetadataWithTraversal>()); if (!hashset.Contains(definition)) hashset.Add(definition); }
private void NewReport() { using (XF_ReportNew form = new XF_ReportNew()) { if (form.ShowDialog() == DialogResult.Yes) { XtraReport report = new XtraReport(); report.CreateDocument(false); using (MemoryStream stream = new MemoryStream()) { report.SaveLayout(stream); FileObject rep = new FileObject(); rep.FileName = form.FileName; rep.FileDescription = form.FileDescription; rep.FileExtension = "repx"; rep.FileBlob = stream.ToArray(); this.DbContext.Add(rep); this.DbContext.SaveChanges(); report.DisplayName = form.FileName; report.Tag = rep.FileID; this.Editor.OpenReport(report); this.Editor.ActiveDesignPanel.ReportState = ReportState.Opened; } } } }
public override IReportController GetController(XtraReport report) { var runtimeActions = GetRuntimeActions(_additionalReportActions); var facade = new XRRuntimeActionFacade(runtimeActions); return new XRReportController(report, facade); }