| 274 | | /* |
| 275 | | /// <summary> |
| 276 | | /// FAKTURA DLA POZNANIA |
| 277 | | /// </summary> |
| 278 | | /// <param name="idFakt"></param> |
| 279 | | public FactureViewer(int idFakt) |
| 280 | | { |
| 281 | | InitializeComponent(); |
| 282 | | |
| 283 | | idFaktury = idFakt; |
| 284 | | |
| 285 | | this.btnRefresh.Click += new EventHandler(zapiszPoznanButton_Click); |
| 286 | | |
| 287 | | fakturaTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; |
| 288 | | fakturA_DETAILSTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; |
| 289 | | fAKTURYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| 290 | | proformaTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| 291 | | |
| 292 | | ds = new DataSet(); |
| 293 | | |
| 294 | | //zczytuje dane z pliku z tlumaczeniami |
| 295 | | Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Baza_Reklam.Raporty.faktura.xml"); |
| 296 | | ds.ReadXml(s); |
| 297 | | |
| 298 | | fAKTURYTableAdapter.FillByIdFaktury(this.rEKLAMADataSet.FAKTURY, idFakt); |
| 299 | | |
| 300 | | typComboBox.Enabled = false; |
| 301 | | // wersjaComboBox.Enabled = false; |
| 302 | | // jezykComboBox.Enabled = false; |
| 303 | | |
| 304 | | reportViewer1.LocalReport.ReportEmbeddedResource = "Baza_Reklam.Raporty.fakturaPoznan.rdlc"; |
| 305 | | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", fakturaTableAdapter1.GetDataByIdFaktury(idFakt))); |
| 306 | | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("FakturaDetails", fakturA_DETAILSTableAdapter1.GetDataByIdFaktury(idFakt))); |
| 307 | | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("tlumaczenia", ds.Tables[0])); |
| 308 | | |
| 309 | | jezykComboBox.SelectedIndex = 0; |
| 310 | | typComboBox.SelectedIndex = 1; |
| 311 | | // wersjaComboBox.SelectedIndex = 0; |
| 312 | | } |
| 313 | | */ |
| 314 | | |
| 315 | | |
| 474 | | |
| 475 | | //drukowanie raportu serwerowego |
| 476 | | /* |
| 477 | | private int m_currentPageIndex; |
| 478 | | private IList<Stream> m_streams; |
| 479 | | |
| 480 | | |
| 481 | | public void HandlePrint(object sender, CancelEventArgs e) |
| 482 | | { |
| 483 | | Run(); |
| 484 | | //MessageBox.Show("Drukowanie"); |
| 485 | | e.Cancel = true; |
| 486 | | } |
| 487 | | |
| 488 | | private void Print(PrinterSettings printerSettings) |
| 489 | | { |
| 490 | | MessageBox.Show("PrintBegin"); |
| 491 | | if (m_streams == null || m_streams.Count == 0) |
| 492 | | return; |
| 493 | | |
| 494 | | PrintDocument printDoc = new PrintDocument(); |
| 495 | | printDoc.PrinterSettings = printerSettings; |
| 496 | | printDoc.PrintPage += new PrintPageEventHandler(PrintPage); |
| 497 | | MessageBox.Show("Print"); |
| 498 | | printDoc.Print(); |
| 499 | | } |
| 500 | | |
| 501 | | private void Run() |
| 502 | | { |
| 503 | | PrintDialog printDialog = new PrintDialog(); |
| 504 | | if (printDialog.ShowDialog() == DialogResult.OK) |
| 505 | | { |
| 506 | | MessageBox.Show("Export"); |
| 507 | | Export(reportViewer1.ServerReport); |
| 508 | | m_currentPageIndex = 0; |
| 509 | | MessageBox.Show("Print"); |
| 510 | | Print(printDialog.PrinterSettings); |
| 511 | | } |
| 512 | | } |
| 513 | | |
| 514 | | private void PrintPage(object sender, PrintPageEventArgs ev) |
| 515 | | { |
| 516 | | MessageBox.Show("PrintPage1"); |
| 517 | | Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]); |
| 518 | | pageImage.Save("C:\\testestPRO.emf"); |
| 519 | | |
| 520 | | // Note: Coordinate (0,0) does not coincide with the top left corner of |
| 521 | | // the page; it coincides with the top left corner of the printable area |
| 522 | | // of the page. To account for this we have to subtract the hard margin. |
| 523 | | |
| 524 | | MessageBox.Show("PrintPage2nnn"); |
| 525 | | RectangleF adjustedRect = new RectangleF( |
| 526 | | ev.PageBounds.Left - ev.PageSettings.HardMarginX, |
| 527 | | ev.PageBounds.Top - ev.PageSettings.HardMarginY, |
| 528 | | ev.PageBounds.Width, ev.PageBounds.Height); |
| 529 | | MessageBox.Show(adjustedRect.Top.ToString() + "*" + adjustedRect.Height.ToString() + "*" + adjustedRect.Width.ToString()); |
| 530 | | ev.Graphics.DrawImage(pageImage, adjustedRect); |
| 531 | | MessageBox.Show("PrintPage4"); |
| 532 | | m_currentPageIndex++; |
| 533 | | ev.HasMorePages = (m_currentPageIndex < m_streams.Count); |
| 534 | | MessageBox.Show("PrintPage5"); |
| 535 | | } |
| 536 | | |
| 537 | | private void Export(ServerReport report) |
| 538 | | { |
| 539 | | MessageBox.Show("ExportBegin"); |
| 540 | | |
| 541 | | string deviceInfo = |
| 542 | | |
| 543 | | "<DeviceInfo>" + |
| 544 | | |
| 545 | | " <OutputFormat>EMF</OutputFormat>" + |
| 546 | | |
| 547 | | " <PageWidth>21cm</PageWidth>" + |
| 548 | | |
| 549 | | " <PageHeight>29cm</PageHeight>" + |
| 550 | | |
| 551 | | " <MarginTop>1cm</MarginTop>" + |
| 552 | | |
| 553 | | " <MarginLeft>1cm</MarginLeft>" + |
| 554 | | |
| 555 | | " <MarginRight>1cm</MarginRight>" + |
| 556 | | |
| 557 | | " <MarginBottom>1cm</MarginBottom>" + |
| 558 | | |
| 559 | | "</DeviceInfo>"; |
| 560 | | |
| 561 | | m_streams = new List<Stream>(); |
| 562 | | string mimeType; |
| 563 | | string extension; |
| 564 | | System.Collections.Specialized.NameValueCollection urlAccessParameters = new System.Collections.Specialized.NameValueCollection(); |
| 565 | | urlAccessParameters.Add("rs:PersistStreams", "True"); |
| 566 | | Stream reportStream = report.Render("Image", deviceInfo, urlAccessParameters, out mimeType, out extension); |
| 567 | | m_streams.Add(reportStream); |
| 568 | | urlAccessParameters.Remove("rs:PersistStreams"); |
| 569 | | urlAccessParameters.Add("rs:GetNextStream", "True"); |
| 570 | | while (reportStream.Length != 0) |
| 571 | | { |
| 572 | | reportStream = |
| 573 | | report.Render("Image", deviceInfo, urlAccessParameters, out mimeType, out extension); |
| 574 | | m_streams.Add(reportStream); |
| 575 | | } |
| 576 | | |
| 577 | | m_streams.RemoveAt(m_streams.Count - 1); |
| 578 | | |
| 579 | | foreach (Stream stream in m_streams) |
| 580 | | stream.Position = 0; |
| 581 | | |
| 582 | | MessageBox.Show("ExportEnd"); |
| 583 | | } |
| 584 | | */ |