private async void PrintCommandAction(object obj) { using (var print = new HelperPrint()) { if (SelectedPTI.Details.Count <= 0) { var res = await ptiContext.GetDetailOfPTI(SelectedPTI); foreach (var item in res) { SelectedPTI.Details.Add(item); } var header = new ReportDataSource() { Value = print.ToDataTable <PTI>(new List <PTI> { SelectedPTI }), Name = "Header" }; var source = new ReportDataSource() { Name = "Detail", Value = print.ToDataTable <collies>(SelectedPTI.Details.ToList()) }; var datasources = new List <ReportDataSource>() { header, source }; print.PrintDocument(datasources, "MainApp.Reports.Layouts.PTI.rdlc", null); } } }
private void SaveAndPrintAction() { Save.Execute(null); if (this.Number > 0) { var print = new HelperPrint(); var data = this.GetInvoiceReportModel(); var config = HelperPrint.GetReportSetting(); var configSource = new ReportDataSource { Value = config, Name = "Config" }; config.FirstOrDefault().SignName = ResourcesBase.User.FullName ?? ResourcesBase.User.UserName; var dataSource = new ReportDataSource { Value = data.OrderBy(x => x.STT), Name = "DataSet1" }; var datasources = new List <ReportDataSource> { dataSource, configSource }; print.PrintDocument(datasources, "TrireksaApp.Reports.Layouts.InvoiceLayout.rdlc", null); } }