/// <summary> /// Exibe o relatório informado. /// </summary> /// <param name="xreport"></param> /// <param name="ribbon"></param> public static void ShowPreviewReport(XtraReport xreport, bool ribbon = false) { //call progressbar XFrmWait.ShowSplashScreen("Gerando relatório..."); //chama a tela de parametros xreport.CreateDocument(); //close a progressbar XFrmWait.CloseSplashScreen(); if (ribbon) { xreport.ShowRibbonPreview(); } xreport.ShowPreview(); }
private void btnIcmalleriGoster_Click(object sender, EventArgs e) { if (!validationProvider.Validate()) { return; } var icmalRaporIsleri = new IcmalRapor(); var raporAylikIcmaller = new XtraReport(); var raporYillikIcmal = new XtraReport(); var raporYillikIcmaller = new XtraReport(); switch (txtKarakol.Text) { case "Hepsi": raporAylikIcmaller.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\AylikIcmalHepsi.repx"); break; case "Merkez": raporAylikIcmaller.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\AylikIcmalMerkez.repx"); break; case "Kemer": raporAylikIcmaller.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\AylikIcmalKemer.repx"); break; } raporYillikIcmal.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\YillikIcmal.repx"); raporYillikIcmaller.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\YillikIcmaller.repx"); var aylikDataSource = icmalRaporIsleri.Aylik(int.Parse(txtYil.Text), "Hepsi", int.Parse(txtTanzimEden.EditValue.ToString()), int.Parse(txtTastikEden.EditValue.ToString())); var yillikDataSource = icmalRaporIsleri.Yillik(int.Parse(txtYil.Text), int.Parse(txtTanzimEden.EditValue.ToString()), int.Parse(txtTastikEden.EditValue.ToString())); var yilliklarDataSource = icmalRaporIsleri.Yilliklar(int.Parse(txtYil.Text)); raporYillikIcmaller.DataSource = yilliklarDataSource; raporYillikIcmal.DataSource = yillikDataSource; raporAylikIcmaller.DataSource = aylikDataSource; raporAylikIcmaller.ShowRibbonPreview(); raporYillikIcmal.ShowRibbonPreview(); raporYillikIcmaller.ShowRibbonPreview(); }
void PrintReport() { XtraReport billToPrint = new XtraReport(); decimal calculatedAmount = 0; var rec = _invoiceService.Get(invoiceId); if (rec.WithholdingRate != 0) { billToPrint.LoadLayout(Application.StartupPath + "/Reports/TevkifFatura.repx"); calculatedAmount = rec.TotalAmount + (rec.TaxAmount / 10) * (10 - rec.WithholdingRate); } else { billToPrint.LoadLayout(Application.StartupPath + "/Reports/KdvFatura.repx"); calculatedAmount = rec.TotalAmount + rec.TaxAmount; } billToPrint.Parameters["Number"].Value = invoiceId; billToPrint.Parameters["WithText"].Value = AmountToText.ConvertToText(calculatedAmount); billToPrint.ShowRibbonPreview(); }
private void btnCikti_ItemClick(object sender, ItemClickEventArgs e) { var topluCiktilar = new Collection <long>(); for (var i = 0; i < grdVOlaylar.DataRowCount; i++) { topluCiktilar.Add(int.Parse(grdVOlaylar.GetRowCellValue(i, "Id").ToString())); } var ustYazi = new XtraReport(); var tutanak = new XtraReport(); ustYazi.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\UstYazi.repx"); tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak.repx"); var daimiCikti = (new ETSEntities().DaimiArastirmaTutanaklari.AsEnumerable() .Select(r => new { r, list = topluCiktilar }) .Where(@t => (@t.list.Contains(@t.r.Id))) .Select(@t => @t.r)).ToList(); foreach (var t in daimiCikti.Where(t => t.Personel3Id == null && t.Personel4Id == null)) { tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak2Imza.repx"); } foreach (var t in daimiCikti.Where(t => t.Personel3Id != null && t.Personel4Id == null)) { tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak3Imza.repx"); } ustYazi.DataSource = daimiCikti; ustYazi.ShowRibbonPreview(); tutanak.DataSource = daimiCikti; tutanak.ShowRibbonPreview(); }
private void btnDegisiklikleriUygula_Click(object sender, EventArgs e) { var ustYazi = new XtraReport(); var tutanak = new XtraReport(); ustYazi.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\UstYazi.repx"); tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak.repx"); var daimiCikti = (new ETSEntities().DaimiArastirmaTutanaklari.AsEnumerable().Select(r => new { r, list = _topluCiktilar }).Where(@t => (@t.list.Contains(@t.r.Id))).Select(@t => @t.r)).ToList(); foreach (var t in daimiCikti) { if (txtBaslik.EditValue.ToString().Length < 5) { var id = int.Parse(txtBaslik.EditValue.ToString()); t.Baslik = new ETSEntities().Baslik.SingleOrDefault(x => x.Id == id); } if (!string.IsNullOrWhiteSpace(txtPeriyotYili.SelectedText)) { t.PeriyotYili = Convert.ToInt32(txtPeriyotYili.Text); } if (txtPeriyot.EditValue != null && txtPeriyot.EditValue.ToString().Length < 5) { var id = int.Parse(txtPeriyot.EditValue.ToString()); t.Periyotlar = new ETSEntities().Periyotlar.SingleOrDefault(x => x.Id == id); } if (txtPersonel1.EditValue != null && txtPersonel1.EditValue.ToString().Length < 5) { var id = int.Parse(txtPersonel1.EditValue.ToString()); t.Personel = new ETSEntities().Personel.SingleOrDefault(x => x.Id == id); t.Personel1Id = id; } if (txtPersonel2.EditValue != null && txtPersonel2.EditValue.ToString().Length < 5) { var id = int.Parse(txtPersonel2.EditValue.ToString()); t.Personel1 = new ETSEntities().Personel.SingleOrDefault(x => x.Id == id); t.Personel2Id = id; } if (txtPersonel3.EditValue != null && txtPersonel3.EditValue.ToString().Length < 5) { var id = int.Parse(txtPersonel3.EditValue.ToString()); t.Personel2 = new ETSEntities().Personel.SingleOrDefault(x => x.Id == id); t.Personel3Id = id; } if (txtPersonel4.EditValue != null && txtPersonel4.EditValue.ToString().Length < 5) { var id = int.Parse(txtPersonel4.EditValue.ToString()); t.Personel3 = new ETSEntities().Personel.SingleOrDefault(x => x.Id == id); t.Personel4Id = id; } } ustYazi.DataSource = daimiCikti; ustYazi.ShowRibbonPreview(); foreach (var t in daimiCikti.Where(t => t.Personel3Id == null && t.Personel4Id == null)) { tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak2Imza.repx"); } foreach (var t in daimiCikti.Where(t => t.Personel3Id != null && t.Personel4Id == null)) { tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak3Imza.repx"); } tutanak.DataSource = daimiCikti; tutanak.ShowRibbonPreview(); Close(); }
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(); } }
/// <summary> /// Raporu hazırla /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRaporla_Click(object sender, EventArgs e) { var raporSayfa1Data = new List <GelenGidenArsivSayfa1DTO>(); var raporSayfa2Data = new List <GelenGidenArsivSayfa2DTO>(); var raporSayfa3Data = new List <GelenGidenArsivSayfa3DTO>(); using (var db = new ETSEntities()) { var raporlanacakEvraklar = db.ArsivGelenGiden.Where(w => _topluCiktilar.Contains(w.Id)).ToList(); raporSayfa1Data.Add(new GelenGidenArsivSayfa1DTO { ArsivKategorisi = chkKategori.Checked ? "A" : "B", BaskanlikAdi = txtBaskanlik.Text, DaireAdi = txtDaire.Text, DepoNu = txtDepoNu.Text, DepoOdaNu = txtDepoOdaNu.Text, DolapNu = txtDolapNu.Text, EnvanterNumarasi = txtEnvaterNu.Text, EnvanteriDuzenlenenArsivDonemi = txtEnvaterArsivDonemi.Text, EnvanterinDuzenlendigiTarih = txtEnvaterinDuzenlendigiTarih.DateTime, EnvanterinDuzenlenmeAmaci = txtEnvaterDuzenlemeAmaci.Text, KomutanlikKurumAdi = txtKomutanlik.Text, KonuGrubuNu = txtKonuGrupNu.Text, KonusYeri = txtKonusYeri.Text, KutuDosyaNu = txtKutuDosyaNu.Text, RafNu = txtRafNu.Text, SandikNu = txtSandikNu.Text, SubeAdi = txtSube.Text, TasnifKuruluPersonelleri = new List <RaporPersonelDTO>() }); raporSayfa2Data.Add(new GelenGidenArsivSayfa2DTO { ArsivGelenGiden = new List <ArsivGelenGidenDTO>() }); raporlanacakEvraklar.ForEach(f => raporSayfa2Data[0].ArsivGelenGiden.Add(new ArsivGelenGidenDTO { AraSayiNo = f.AraSayiNo, CikaranMakam = f.EvrakiCikaranMakam.Makam, DosyaNo = f.DosyaNo, IlgiliEvrak = f.IlgiliEvrak, Tarih = f.Tarih, IlkEvrak = f.IlkEvrak, Sube = f.Subeler.Sube, EkSayisi = f.EkSayisi, EsasKonuNo = f.EsasKonuNo, ImhaYili = f.ImhaYili, Konusu = f.Konusu, Yil = f.Yil, GelenEvrak = f.GelenEvrakId, GidenEvrak = f.GidenEvrakId, GizililikDerecesi = f.GizlilikDerecesi.Derece, IlgiliBirim = f.Birimler.Birim })); raporSayfa3Data.Add(new GelenGidenArsivSayfa3DTO { DevirTeslimPersonelleri = new List <RaporPersonelDTO>() }); for (var i = 0; i < lstDevirTeslimPersonelleri.Items.Count; i++) { var personelId = int.Parse(lstDevirTeslimPersonelleri.Items[i].ToString().Split('|')[0]); var personel = db.Personel.SingleOrDefault(s => s.Id == personelId); if (personel != null) { raporSayfa3Data[0].DevirTeslimPersonelleri.Add(new RaporPersonelDTO { Pozisyon = i % 2 != 0 ? "Teslim Eden" : "Teslim Alan", Adi = personel.Adi, Gorevi = personel.Gorevi, Rutbesi = personel.Rutbesi, Sicili = personel.Sicili, Soyadi = personel.Soyadi }); } } for (var i = 0; i < lstTasnifPersoneller.Items.Count; i++) { var personelId = int.Parse(lstTasnifPersoneller.Items[i].ToString().Split('|')[0]); var personel = db.Personel.SingleOrDefault(s => s.Id == personelId); if (personel != null) { raporSayfa1Data[0].TasnifKuruluPersonelleri.Add(new RaporPersonelDTO { Pozisyon = i == 0 ? "Başkan" : "Üye", Adi = personel.Adi, Gorevi = personel.Gorevi, Rutbesi = personel.Rutbesi, Sicili = personel.Sicili, Soyadi = personel.Soyadi }); } } var raporSayfa1 = new XtraReport(); raporSayfa1.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\GelenGidenArsivSayfa1.repx"); var raporSayfa2 = new XtraReport(); raporSayfa1.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\GelenGidenArsivSayfa2.repx"); var raporSayfa3 = new XtraReport(); raporSayfa1.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\GelenGidenArsivSayfa3.repx"); raporSayfa1.DataSource = raporSayfa1Data; raporSayfa2.DataSource = raporSayfa2Data; raporSayfa3.DataSource = raporSayfa3Data; raporSayfa1.ShowRibbonPreview(); raporSayfa2.ShowRibbonPreview(); raporSayfa3.ShowRibbonPreview(); } }
private static void printReport(int idreport, bool requestParameters = true, bool visibleParameters = true, bool ribbon = false) { try { using (var ctx = new ReportContext()) { var current = ctx.ReportImageDao.Find(idreport); string reportDir = Path.GetTempPath().Replace("Temp", "Reports"); string path = Path.Combine(reportDir, current.ReportName + ".repx"); //var pathPrnx = Path.Combine(Application.StartupPath, "Reports", current.ReportName + ".prnx"); //carregue a estrutura do relatório XtraReport xreport = new XtraReport(); if (!File.Exists(path)) { FileManagerIts.WriteBytesToFile(path, current.ReportImageData); } xreport.LoadLayout(path); var ds = xreport.DataSource as SqlDataSource; var appConf = AppConfigManager.Configuration.AppConfig; if (ds == null) { ds = new SqlDataSource(appConf.ServerName); } SetParamDataSource(ds, appConf); ds.Connection.CreateConnectionString(); ds.RebuildResultSchema(); //objeto para gerar a tela de parametros ReportPrintTool reportPrintTool = new ReportPrintTool(xreport); //permissao para solicitar os parametros xreport.RequestParameters = requestParameters; //permissao para exibir os parametros if (visibleParameters == false) { foreach (var p in xreport.Parameters) { p.Visible = false; } } //chama a tela de parametros xreport.CreateDocument(); //libera memoria da ferramenta reportPrintTool.Dispose(); if (ribbon) { //chama o ribbon para exibir o relatório xreport.ShowRibbonPreview(); } else { xreport.ShowPreview(); } ////carregando o relatório manualmente ////salva o documento gerado em prnx //xreport.PrintingSystem.SaveDocument(pathPrnx); //// Create a PrintingSystem instance. //PrintingSystem ps = new PrintingSystem(); //// Load the document from a file. //ps.LoadDocument(pathPrnx); ////ribbon form para visualizar o relatório //PrintPreviewRibbonFormEx preview = new PrintPreviewRibbonFormEx(); //preview.PrintingSystem = ps; ////xtraform para visualizar o relatório //PrintPreviewFormEx prev = new PrintPreviewFormEx(); //prev.PrintingSystem = ps; ////exibe o relatorio //preview.ShowDialog(); } } catch (Exception ex) { XMessageIts.Erro("Falha gerar relatório\n\n" + ex.Message, "Atenção!!!"); LoggerUtilIts.GenerateLogs(ex); } }