private void AnggotaReportForm_Loaded(object sender, RoutedEventArgs e) { var Data = Helpers.GetMainViewModel(); reportViewer.LocalReport.DataSources.Clear(); ReportDataSource DataSet1 = new ReportDataSource { Name = "DataSet1", // Name of the DataSet we set in .rdlc Value = Data.Anggota.Source }; // reportViewer.LocalReport.DataSources= list; reportViewer.LocalReport.ReportEmbeddedResource = "AppAbsen.Reports.AnggotaLayout.rdlc"; reportViewer.LocalReport.DataSources.Add(DataSet1); reportViewer.SetDisplayMode(DisplayMode.PrintLayout); reportViewer.ZoomMode = ZoomMode.PageWidth; System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); ps.Landscape = true; ps.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170); ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4; ps.Margins.Top = 1; ps.Margins.Bottom = 1; ps.Margins.Left = 20; ps.Margins.Right = 1; reportViewer.SetPageSettings(ps); reportViewer.RefreshReport(); }
public PrintPageEventArgs(System.Drawing.Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, System.Drawing.Printing.PageSettings pageSettings) { this.graphics = graphics; this.marginBounds = marginBounds; this.pageBounds = pageBounds; this.pageSettings = pageSettings; }
public static void Run() { try { // ExStart:PrintPageRange // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing(); Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer(); pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings; System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings(); pdfv.BindPdf(dataDir + "Print-PageRange.pdf"); prin.PrinterName = "HP LaserJet M9050 MFP PCL6"; prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor(); pageEditor.BindPdf(dataDir + "input.pdf"); pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pgs.PaperSize = prin.DefaultPageSettings.PaperSize; pdfv.PrintDocumentWithSettings(pgs, prin); pdfv.Close(); // ExEnd:PrintPageRange } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void ProjectSiteDetail_Load(object sender, EventArgs e) { System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); ReportParameter[] rptParams = new ReportParameter[(4)]; rptParams[0] = new ReportParameter("ProjectId", p_ProjectId); rptParams[1] = new ReportParameter("ProjectSite", p_ProjectSite); rptParams[2] = new ReportParameter("ProjectDate", p_ProjectDate); rptParams[3] = new ReportParameter("Date", MonthYear); reportViewer1.LocalReport.SetParameters(rptParams); pg.Margins.Top = 0; //Convert.ToInt32(0.2); pg.Margins.Bottom = 0; pg.Margins.Left = 0; pg.Margins.Right = 0; pg.Landscape = true; reportViewer1.SetPageSettings(pg); reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.maintenanceDataSet08132019BindingSource.DataSource = data.Tables[0]; this.reportViewer1.RefreshReport(); }
private void PageSelect() { PageSetupDialog p = new PageSetupDialog(); System.Drawing.Printing.PageSettings pSet = new System.Drawing.Printing.PageSettings(); pSet.Landscape = myPageSetup.Landscape; System.Drawing.Printing.PaperSize pSize = new System.Drawing.Printing.PaperSize(); pSize.RawKind = myPageSetup.PaperSize; pSet.PaperSize = pSize; p.PageSettings = pSet; if (p.ShowDialog() == DialogResult.OK) { myPageSetup.Landscape = pSet.Landscape; myPageSetup.PaperSize = pSet.PaperSize.RawKind; myPageSetup.PaperName = pSet.PaperSize.PaperName; if (myPageSetup.Landscape) { myPageSetup.PageWidth = pSet.PaperSize.Height; myPageSetup.PageHeight = pSet.PaperSize.Width; myPageSetup.ScaleWidth = pSet.PrintableArea.Height; myPageSetup.ScaleHeight = pSet.PrintableArea.Width; } else { myPageSetup.PageWidth = pSet.PaperSize.Width; myPageSetup.PageHeight = pSet.PaperSize.Height; myPageSetup.ScaleWidth = pSet.PrintableArea.Width; myPageSetup.ScaleHeight = pSet.PrintableArea.Height; } RefreshPrintName(pSet.PaperSize); } }
public PrintPageEventArgs(System.Drawing.Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, System.Drawing.Printing.PageSettings pageSettings) { this.graphics = graphics; this.marginBounds = marginBounds; this.pageBounds = pageBounds; this.pageSettings = pageSettings; }
private void EtiquetasRpt_Load(object sender, EventArgs e) { this.reportViewer1.ProcessingMode = ProcessingMode.Local; string path; if (imprimePrecio) { path = Application.StartupPath + @"\Informes\Etiquetasx2_precio.rdlc"; } else { path = Application.StartupPath + @"\Informes\Etiquetasx2.rdlc"; } this.reportViewer1.LocalReport.ReportPath = path; reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Dataset_informes", tblEtiquetas)); reportViewer1.PrinterSettings.PrinterName = "SATO CG408"; System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); // Set margins pg.Margins = new System.Drawing.Printing.Margins(9, 0, 0, 7); //centesimas de pulgada pg.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 417, 110); //centesimas de pulgada pg.PrinterResolution.Kind = System.Drawing.Printing.PrinterResolutionKind.High; this.reportViewer1.SetPageSettings(pg); this.reportViewer1.RefreshReport(); }
private void frmPrintAdmExp_Load(object sender, EventArgs e) { ReportViewer_AdmExp.PageCountMode = PageCountMode.Actual; ReportDataSource rDS = new ReportDataSource("AdmExpDT", Global.admExpDT); this.ReportViewer_AdmExp.LocalReport.DataSources.Clear(); this.ReportViewer_AdmExp.LocalReport.DataSources.Add(rDS); this.ReportViewer_AdmExp.LocalReport.Refresh(); // 마진 설정 System.Drawing.Printing.PageSettings ps = ReportViewer_AdmExp.GetPageSettings(); ps.Margins = new System.Drawing.Printing.Margins(25, 25, 100, 50); this.ReportViewer_AdmExp.SetPageSettings(ps); // 타이틀에 사용할 년월 정보를 조회된 데이터로 부터 가져온다. string YYYY = Global.admExpDT.Rows[0][(int)Common.AdmExp.yyyymm].ToString().Substring(0, 4); string MM = Global.admExpDT.Rows[0][(int)Common.AdmExp.yyyymm].ToString().Substring(4, 2); // 타이틀 설정 ReportParameter[] rp = new ReportParameter[1]; rp[0] = new ReportParameter("TITLE", string.Format("{0}아파트 관리비({1}년 {2}월)", Util.GetAptName(), YYYY, MM)); this.ReportViewer_AdmExp.LocalReport.SetParameters(rp); // 미리보기 설정 this.ReportViewer_AdmExp.SetDisplayMode(DisplayMode.PrintLayout); this.ReportViewer_AdmExp.RefreshReport(); }
/// <summary> /// Handles the generate button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GenerateReportButton_Click(object sender, EventArgs e) { DateTime start = this.startDateTimePicker.Value; DateTime end = this.endDateTimePicker.Value; if (this.DatesAreValid(start, end)) { ReportParameter[] parameters = new ReportParameter[2]; parameters[0] = new ReportParameter("startDate", start.ToString("D")); parameters[1] = new ReportParameter("endDate", end.ToString("D")); this.reportViewer1.LocalReport.SetParameters(parameters); this.getMostPerformedTestsDuringDatesTableAdapter1.Fill(labTestReportDataSet1.getMostPerformedTestsDuringDates, start, end); System.Drawing.Printing.PageSettings ps = reportViewer1.GetPageSettings(); ps.Landscape = true; reportViewer1.SetPageSettings(ps); this.reportViewer1.RefreshReport(); } else { string boxTitle = "Date Error"; string boxMessage = "The end date must be later than the start date."; MessageBox.Show(boxMessage, boxTitle); } }
private void ReportViewer_Load(object sender, EventArgs e) { DataTable dt = BusLayer.blPurchase.GetReport(bpd); ReportDataSource rds = new ReportDataSource("DCReport", dt); _reportViewer.ProcessingMode = ProcessingMode.Local; LocalReport rep = _reportViewer.LocalReport; System.Drawing.Printing.Margins m = new System.Drawing.Printing.Margins(); m.Left = 0; m.Right = 0; m.Top = 0; m.Bottom = 0; System.Drawing.Printing.PageSettings p = new System.Drawing.Printing.PageSettings(); p.Margins = m; _reportViewer.SetPageSettings(p); rep.ReportPath = "BPDReport.rdlc"; rep.DataSources.Clear(); ReportParameter p1 = new ReportParameter("BPDID", bpd); _reportViewer.LocalReport.SetParameters(p1); rep.DataSources.Add(rds); _reportViewer.RefreshReport(); }
private void EtiquetasRpt_Load(object sender, EventArgs e) { this.reportViewer1.ProcessingMode = ProcessingMode.Local; string path; if (imprimePrecio) { path = Application.StartupPath + @"\Informes\Etiquetasx2_precio.rdlc"; } else { path = Application.StartupPath + @"\Informes\Etiquetasx2.rdlc"; } this.reportViewer1.LocalReport.ReportPath = path; reportViewer1.LocalReport.DataSources.Add( new ReportDataSource("Dataset_informes", tblEtiquetas)); reportViewer1.PrinterSettings.PrinterName = "SATO CG408"; System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); // Set margins pg.Margins = new System.Drawing.Printing.Margins(9, 0, 0, 7); //centesimas de pulgada pg.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 417, 110); //centesimas de pulgada pg.PrinterResolution.Kind = System.Drawing.Printing.PrinterResolutionKind.High; this.reportViewer1.SetPageSettings(pg); this.reportViewer1.RefreshReport(); }
private void AllMaintenanceExpensesReport_Load(object sender, EventArgs e) { System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); ReportParameter[] rptParams = new ReportParameter[(5)]; rptParams[0] = new ReportParameter("Category", Category == string.Empty ? " ": Category); rptParams[1] = new ReportParameter("TypeRepair", TypeRepair == string.Empty ? " " : TypeRepair); rptParams[2] = new ReportParameter("ProjectId", ProjectId == string.Empty ? " " : ProjectId); rptParams[3] = new ReportParameter("Date", DateParam == string.Empty ? " " : DateParam); rptParams[4] = new ReportParameter("isCheck", isCheck == string.Empty ? " " : isCheck); reportViewer1.LocalReport.SetParameters(rptParams); pg.Margins.Top = 0; //Convert.ToInt32(0.2); pg.Margins.Bottom = 0; pg.Margins.Left = 0; pg.Margins.Right = 0; pg.Landscape = true; //pg.PaperSize. //pg.PaperSize.Height = 13; //pg.PaperSize.Width = 8; //reportViewer1.PrinterSettings.DefaultPageSettings.PaperSize = new PaperSize("Custom", 650, 325) reportViewer1.SetPageSettings(pg); reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.maintenanceDataSet08132019BindingSource.DataSource = data; this.reportViewer1.RefreshReport(); }
private void bt_print_Click(object sender, EventArgs e) { /* * //Open the print dialog * PrintDialog printDialog = new PrintDialog(); * printDialog.Document = printDocument1; * printDialog.UseEXDialog = true; * //Get the document * if (DialogResult.OK == printDialog.ShowDialog()) * { * printDocument1.DocumentName = "Test Page Print"; * printDocument1.Print(); * } */ /* * Note: In case you want to show the Print Preview Dialog instead of * Print Dialog then comment the above code and uncomment the following code */ //Open the print preview dialog System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); pg.Margins.Top = 50; pg.Margins.Bottom = 0; pg.Margins.Left = 50; pg.Margins.Right = 0; pg.Landscape = true; printDocument1.DefaultPageSettings = pg; iRow = 0; // a ver a ver PrintPreviewDialog objPPdialog = new PrintPreviewDialog(); objPPdialog.Document = printDocument1; objPPdialog.ShowDialog(); }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer(); pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings; System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings(); pdfv.BindPdf(dataDir + "NewInput.pdf"); prin.PrinterName = "HP LaserJet M9050 MFP PCL6"; prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor(); pageEditor.BindPdf(dataDir+ "temp.pdf"); pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pgs.PaperSize = prin.DefaultPageSettings.PaperSize; pdfv.PrintDocumentWithSettings(pgs, prin); pdfv.Close(); }
public static void Run() { try { // ExStart:PrintPageRange // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing(); Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer(); pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings; System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings(); pdfv.BindPdf(dataDir + "Print-PageRange.pdf"); prin.PrinterName = "HP LaserJet M9050 MFP PCL6"; prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor(); pageEditor.BindPdf(dataDir + "input.pdf"); pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pgs.PaperSize = prin.DefaultPageSettings.PaperSize; pdfv.PrintDocumentWithSettings(pgs, prin); pdfv.Close(); // ExEnd:PrintPageRange } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing(); Aspose.Pdf.Facades.PdfViewer pdfv = new Aspose.Pdf.Facades.PdfViewer(); pdfv.PdfQueryPageSettings += PdfvOnPdfQueryPageSettings; System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrinterSettings prin = new System.Drawing.Printing.PrinterSettings(); pdfv.BindPdf(dataDir + "NewInput.pdf"); prin.PrinterName = "HP LaserJet M9050 MFP PCL6"; prin.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); Aspose.Pdf.Facades.PdfPageEditor pageEditor = new Aspose.Pdf.Facades.PdfPageEditor(); pageEditor.BindPdf(dataDir + "temp.pdf"); pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pgs.PaperSize = prin.DefaultPageSettings.PaperSize; pdfv.PrintDocumentWithSettings(pgs, prin); pdfv.Close(); }
private void UnitFuelReport_Load(object sender, EventArgs e) { System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); ReportParameter[] rptParams = new ReportParameter[(6)]; rptParams[0] = new ReportParameter("EquipmentNo", EquipmentNo); rptParams[1] = new ReportParameter("Model", Model); rptParams[2] = new ReportParameter("PlateNo", PlateNo); rptParams[3] = new ReportParameter("Date", DateParam); rptParams[4] = new ReportParameter("TotalKmUsed", TotalKm); rptParams[5] = new ReportParameter("TotalhrsUsed", TotalHrs); reportViewer1.LocalReport.SetParameters(rptParams); pg.Margins.Top = 0; //Convert.ToInt32(0.2); pg.Margins.Bottom = 0; pg.Margins.Left = 0; pg.Margins.Right = 0; pg.Landscape = true; //pg.PaperSize. //pg.PaperSize.Height = 13; //pg.PaperSize.Width = 8; //reportViewer1.PrinterSettings.DefaultPageSettings.PaperSize = new PaperSize("Custom", 650, 325) reportViewer1.SetPageSettings(pg); reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.maintenanceDataSet08132019BindingSource.DataSource = datavalue.Tables[3];; this.reportViewer1.RefreshReport(); }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { ReportDataSource rds = new ReportDataSource(); ReportDataSource dsNoDR = new ReportDataSource(); ReportDataSource dsWithDR = new ReportDataSource(); if (lstNetworkingSales != null) { rds = new ReportDataSource("DataSet1", lstNetworkingSales); dsNoDR = new ReportDataSource("DataSet2", lstDRNoPayment); dsWithDR = new ReportDataSource("DataSet3", lstDrWithPayment); reportViewer.ProcessingMode = ProcessingMode.Local; LocalReport localReport = reportViewer.LocalReport; localReport.ReportPath = "reports/NetworkingSales.rdlc"; reportViewer.RefreshReport(); System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); ps.Landscape = true; ps.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170); ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4; reportViewer.SetPageSettings(ps); reportViewer.LocalReport.DataSources.Add(rds); reportViewer.LocalReport.DataSources.Add(dsNoDR); reportViewer.LocalReport.DataSources.Add(dsWithDR); // Refresh the report reportViewer.RefreshReport(); } }
public void SetInfo(ReportDataQuadernPag1 pag1, List <ReportDataQuadernPag2t1> pag2t1, List <ReportDataQuadernPag2t2> pag2t2, List <ReportDataQuadernPag2t3> pag2t3, List <ReportDataQuadernPag2t4> pag2t4, List <ReportDataQuadernPag2t5> pag2t5, List <ReportDataQuadernPag3> pag3, List <ReportDataQuadernPag4> pag4, List <ReportDataQuadernPag5> pag5, List <ReportDataQuadernPag6> pag6) { this.reportViewer.Clear(); this.reportViewer.RefreshReport(); this.Size = new System.Drawing.Size(983, 689); this.reportViewer.SetDisplayMode(DisplayMode.PrintLayout); report1DSBindingSource.DataSource = pag1; report2DSBindingSource.DataSource = pag2t1; report3DSBindingSource.DataSource = pag2t2; report4DSBindingSource.DataSource = pag2t3; report5DSBindingSource.DataSource = pag2t4; report6DSBindingSource.DataSource = pag2t5; report7DSBindingSource.DataSource = pag3; report8DSBindingSource.DataSource = pag4; report9DSBindingSource.DataSource = pag5; report10DSBindingSource.DataSource = pag6; ReportParameter[] para = new ReportParameter[1]; para[0] = new ReportParameter("Data", System.DateTime.Today.ToLongDateString()); reportViewer.LocalReport.SetParameters(para); this.reportViewer.LocalReport.EnableExternalImages = true; System.Drawing.Printing.PageSettings setup = this.reportViewer.GetPageSettings(); setup.Margins = new System.Drawing.Printing.Margins(5, 5, 5, 5); setup.Landscape = true; this.reportViewer.SetPageSettings(setup); this.reportViewer.RefreshReport(); }
private void TruckMonthlyReport_Load(object sender, EventArgs e) { System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); ReportParameter[] rptParams = new ReportParameter[(1)]; rptParams[0] = new ReportParameter("MonthYear", MonthYear); reportViewer1.LocalReport.SetParameters(rptParams); var setup = reportViewer1.GetPageSettings(); //setup.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pg.Margins.Top = 0; //Convert.ToInt32(0.2); pg.Margins.Bottom = 0; pg.Margins.Left = 0; pg.Margins.Right = 0; pg.Landscape = true; reportViewer1.SetPageSettings(pg); reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); //this.reportviewer1.loca= datagridl; this.maintenanceDataSet08132019BindingSource.DataSource = DataGridl; this.reportViewer1.RefreshReport(); }
void p_R_RenderingComplete(object sender, RenderingCompleteEventArgs e) { //MessageBox.Show("ORIGINAL \n centimetros left:" + reportViewer1.Margin.Left.ToString() + "\n" + "centimetros top:" + reportViewer1.Margin.Top.ToString()); //if (reportViewer1.GetTotalPages() > 1) //{ // MessageBox.Show("El reporte contiene mas de una página, esto puede ocasionar una impresión erronea en el reporte, reduzca el contenido de los campos que se encuentran al final del formulario o campos extensos como por ejemplo observaciones o documentacion extra", "Error en el reporte", MessageBoxButtons.OK, MessageBoxIcon.Error); // reportViewer1.ParentForm.Close(); //} if (seted == false) { seted = true; System.Drawing.Printing.PageSettings PS = new System.Drawing.Printing.PageSettings(); PS.Margins.Top = Convert.ToInt32(Class.Medida.ObtenerMedidaVertical() * 100m); PS.Margins.Left = Convert.ToInt32(Class.Medida.ObtenerMedidaHorizontal() * 100m); PS.Margins.Bottom = 0; PS.Margins.Right = 0; PS.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); reportViewer1.SetPageSettings(PS); reportViewer1.RefreshReport(); //MessageBox.Show("centimetros left:" + PS.Margins.Left.ToString() + "\n" + "centimetros top:" + PS.Margins.Top.ToString()); } }
private void FormProduct_Load(object sender, EventArgs e) { // Set Form/controls properties this.comboBoxCat.TabIndex = 0; this.AutoSize = true; this.AutoScroll = true; System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); ps.Landscape = true; ps.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170); ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4; reportViewer1.SetPageSettings(ps); //reportViewer1.SizeToReportContent = true; AEC_IlluminationDataSet.EnforceConstraints = false; // TODO: This line of code loads data into the 'AEC_IlluminationDataSet.GetProducts' table. You can move, or remove it, as needed. string strCat = ""; string strSubCat = ""; string strOS = ""; float fltmA = 0; this.GetProductsTableAdapter.Fill(this.AEC_IlluminationDataSet.GetProducts, strCat, strSubCat, strOS, fltmA); this.reportViewer1.RefreshReport(); }
private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { Datapass = ((DatePicker)sender).SelectedDate.Value; var Data = new AbsenTanggalContext(); reportViewer.LocalReport.DataSources.Clear(); ReportDataSource DataSet1 = new ReportDataSource { Name = "DataSet1", // Name of the DataSet we set in .rdlc Value = Data.GetSource(Datapass) }; // reportViewer.LocalReport.DataSources= list; reportViewer.LocalReport.ReportEmbeddedResource = "AppAbsen.Reports.AbsenTanggalLayout.rdlc"; reportViewer.LocalReport.DataSources.Add(DataSet1); reportViewer.SetDisplayMode(DisplayMode.PrintLayout); reportViewer.ZoomMode = ZoomMode.PageWidth; System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings { Landscape = false, PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170) }; ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4; reportViewer.SetPageSettings(ps); reportViewer.RefreshReport(); }
private void R_Articulos_Load(object sender, EventArgs e) { Microsoft.Reporting.WinForms.ReportParameter Descripcion; if (tagIndicador == 1) { Descripcion = new Microsoft.Reporting.WinForms.ReportParameter("Descripcion", "Stock Bajo"); System.Drawing.Printing.PageSettings page = new System.Drawing.Printing.PageSettings(); page.Margins = new System.Drawing.Printing.Margins(50, 50, 50, 50); reportViewer1.SetPageSettings(page); ArticulosBindingSource.DataSource = Cdatos_reportes.StockBajo(); } else if (tagIndicador == 2) { Descripcion = new Microsoft.Reporting.WinForms.ReportParameter("Descripcion", "Stock medio"); ArticulosBindingSource.DataSource = Cdatos_reportes.StockMedio(); } else if (tagIndicador == 3) { Descripcion = new Microsoft.Reporting.WinForms.ReportParameter("Descripcion", "Stock Alto"); ArticulosBindingSource.DataSource = Cdatos_reportes.StockAlto(); } else { Descripcion = new Microsoft.Reporting.WinForms.ReportParameter("Descripcion", "Stock Todos"); ArticulosBindingSource.DataSource = Cdatos_reportes.StockTodos(); } reportViewer1.LocalReport.SetParameters(Descripcion); this.reportViewer1.RefreshReport(); }
public RevenuePrintForm() { InitializeComponent(); rbMonth.Checked = true; lblPeriod.Visible = false; cboPeriod.Visible = false; Dictionary <int, int> periodOptions = new Dictionary <int, int>(); periodOptions.Add(1, 1); periodOptions.Add(2, 2); periodOptions.Add(3, 3); periodOptions.Add(4, 4); Utilities.LoadComboBoxOptions(cboPeriod, periodOptions); System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); ps.Landscape = true; ps.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170); ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4; rptViewer.SetPageSettings(ps); dtpFromMonth.Format = DateTimePickerFormat.Custom; dtpFromMonth.CustomFormat = "MM/yyyy"; dtpFromMonth.ShowUpDown = true; }
public RdlcReport(String code, int num, int model) { this.model = 1; this.code = code; this.num = num; InitializeComponent(); reportViewer1.LocalReport.EnableExternalImages = true; BarCode128 barCode = new BarCode128(); code = "91" + code + "0000" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now); FileInfo file = new FileInfo(Application.StartupPath + "\\code.jpg"); if (file.Exists) { file.Delete(); } barCode.GetCodeImage(code, LabelPrint.MvcGuestBook.Common.BarCode128.Encode.Code128C).Save("code.jpg"); System.Drawing.Printing.PageSettings ps = reportViewer1.GetPageSettings();// new System.Drawing.Printing.PageSettings(); ps.Landscape = false; Microsoft.Reporting.WinForms.ReportParameter params1; params1 = new Microsoft.Reporting.WinForms.ReportParameter("ImageAddress", "file:///" + Application.StartupPath + "\\code.jpg"); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter[] { params1 }); reportViewer1.SetPageSettings(ps); }
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { m_Graphics = e.Graphics; m_Font = new Font("細明體", 12.0f); m_Brush = SystemBrushes.WindowText; System.Drawing.Printing.PageSettings settings = e.PageSettings; Rectangle inner = e.MarginBounds; Rectangle outter = e.PageBounds; e.HasMorePages = false; int x = inner.Left; int y = inner.Top; int height = inner.Height / 40; int month = comboBoxMonth.SelectedIndex; int more = m_More; y = printOneMonth(x, y, height, month, ref more); if (m_PrintIndex == 1 && more == -1) { return; // 只有一頁的不印碼 } m_Graphics.DrawString(" Page " + m_PrintIndex.ToString(), m_Font, m_Brush, x, inner.Bottom - height); if (more != -1) { e.HasMorePages = true; m_More = more; m_PrintIndex++; } }
private void R_Venta_Load(object sender, EventArgs e) { Microsoft.Reporting.WinForms.ReportParameter Fecha = new Microsoft.Reporting.WinForms.ReportParameter("Fecha", _Fecha.ToShortDateString()); Microsoft.Reporting.WinForms.ReportParameter NumeroVenta = new Microsoft.Reporting.WinForms.ReportParameter("NumeroVenta", oVenta.ID.ToString()); Microsoft.Reporting.WinForms.ReportParameter NumCaja = new Microsoft.Reporting.WinForms.ReportParameter("NumCaja", id_Caja_diaria.ToString()); Microsoft.Reporting.WinForms.ReportParameter Subtotal = new Microsoft.Reporting.WinForms.ReportParameter("Subtotal", oVenta.Subtotal.ToString()); Microsoft.Reporting.WinForms.ReportParameter Descuento = new Microsoft.Reporting.WinForms.ReportParameter("Descuento", oVenta.DescRecargo.ToString()); Microsoft.Reporting.WinForms.ReportParameter Total = new Microsoft.Reporting.WinForms.ReportParameter("Total", oVenta.Total.ToString()); Microsoft.Reporting.WinForms.ReportParameter FormaDePago = new Microsoft.Reporting.WinForms.ReportParameter("FormaDePago", oVenta.Pago.FormaPago.Descripcion); reportViewer1.LocalReport.SetParameters(FormaDePago); reportViewer1.LocalReport.SetParameters(Fecha); reportViewer1.LocalReport.SetParameters(NumeroVenta); reportViewer1.LocalReport.SetParameters(NumCaja); reportViewer1.LocalReport.SetParameters(Subtotal); reportViewer1.LocalReport.SetParameters(Descuento); reportViewer1.LocalReport.SetParameters(Total); ItemsBindingSource.DataSource = Cdatos_ventas.DevolverItemsVenta(oVenta, id_Caja_diaria); System.Drawing.Printing.PageSettings page = new System.Drawing.Printing.PageSettings(); /*System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize(); * size.RawKind = (int)System.Drawing.Printing.PaperKind.A5; ; * page.PaperSize = size;*/ page.Margins = new System.Drawing.Printing.Margins(50, 50, 50, 50); reportViewer1.SetPageSettings(page); this.reportViewer1.RefreshReport(); }
private void Print_Click(object sender, RoutedEventArgs e) { try { var idx = (TrnPengirimanModel)Dgv_Home.SelectedItem; if (idx == null) { MessageBox.Show("Tidak ada data yg dipilih", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } using (new WaitCursor()) { var connectString = ConfigurationManager.ConnectionStrings["TIMBANGANEntities"].ConnectionString; var entityStringBuilder = new EntityConnectionStringBuilder(connectString); SqlConnectionStringBuilder SqlConnection = new SqlConnectionStringBuilder(entityStringBuilder.ProviderConnectionString); var PrinterName = ConfigurationManager.AppSettings["PrinterName"]; ReportDocument cryRpt = new ReportDocument(); // this will be in a temp directory. string SystemPath = System.AppDomain.CurrentDomain.BaseDirectory; //once you have the path you get the directory with: var directory = System.IO.Path.GetDirectoryName(SystemPath); cryRpt.Load(SystemPath + "\\Reports\\ReportSuratJalan3.rpt"); cryRpt.SetDatabaseLogon(SqlConnection.UserID, SqlConnection.Password, SqlConnection.DataSource, SqlConnection.InitialCatalog); cryRpt.SetParameterValue("id", idx.ID); //cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, fullPath); System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(); var paper = new System.Drawing.Printing.PaperSize("Custom", 850, 650); printersettings.DefaultPageSettings.Landscape = false; printersettings.DefaultPageSettings.PaperSize = paper; pageSettings.PaperSize = paper; pageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pageSettings.Landscape = false; var nama = System.Drawing.Printing.PrinterSettings.InstalledPrinters; printersettings.PrinterName = PrinterName; cryRpt.PrintToPrinter(printersettings, pageSettings, false); } MessageBox.Show("File Printing", Constans.SubmitMessageTittle.Sukses, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception exp) { LogError.WriteError(exp); MessageBox.Show(Constans.SubmitMessage.Error, Constans.SubmitMessageTittle.Error, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void ShowPageSettings() { PFDataGridViewPrinter _dgvPrinter = new PFDataGridViewPrinter(); InitDataGridViewPrinter(_dgvPrinter); _dgvPrinter.ShowPageSettingsDialog(); _savePageSettings = _dgvPrinter.Printer.printDoc.DefaultPageSettings; }
private void R_Usuarios_Load(object sender, EventArgs e) { UsuariosBindingSource.DataSource = Cdatos_reportes.Usuarios(altas); System.Drawing.Printing.PageSettings page = new System.Drawing.Printing.PageSettings(); page.Margins = new System.Drawing.Printing.Margins(50, 50, 50, 50); reportViewer1.SetPageSettings(page); this.reportViewer1.RefreshReport(); }
private void Print_Click(object sender, RoutedEventArgs e) { try { if (string.IsNullOrEmpty(Filter_Tanggal.Text)) { MessageBox.Show("Filter tidak boleh kosong", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } using (new WaitCursor()) { var connectString = ConfigurationManager.ConnectionStrings["TIMBANGANEntities"].ConnectionString; var entityStringBuilder = new EntityConnectionStringBuilder(connectString); SqlConnectionStringBuilder SqlConnection = new SqlConnectionStringBuilder(entityStringBuilder.ProviderConnectionString); var PrinterName = ConfigurationManager.AppSettings["PrinterName"]; ReportDocument cryRpt = new ReportDocument(); // this will be in a temp directory. string SystemPath = System.AppDomain.CurrentDomain.BaseDirectory; //once you have the path you get the directory with: var directory = System.IO.Path.GetDirectoryName(SystemPath); var Date = Convert.ToDateTime(Filter_Tanggal.Text); cryRpt.Load(SystemPath + "\\Reports\\ReportRealisasiHarian.rpt"); cryRpt.SetDatabaseLogon(SqlConnection.UserID, SqlConnection.Password, SqlConnection.DataSource, SqlConnection.InitialCatalog); cryRpt.SetParameterValue("@Date", Date.ToString("yyyy-MM-dd")); //cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, fullPath); System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(); var paper = new System.Drawing.Printing.PaperSize("A4", 650, 850); printersettings.DefaultPageSettings.Landscape = false; printersettings.DefaultPageSettings.PaperSize = paper; pageSettings.PaperSize = paper; pageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pageSettings.Landscape = false; var nama = System.Drawing.Printing.PrinterSettings.InstalledPrinters; printersettings.PrinterName = PrinterName; cryRpt.PrintToPrinter(printersettings, pageSettings, false); } MessageBox.Show("File Printing", Constans.SubmitMessageTittle.Sukses, MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception exp) { LogError.WriteError(exp); MessageBox.Show(Constans.SubmitMessage.Error, Constans.SubmitMessageTittle.Error, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Btn_PrintToPrinter_Click(object sender, RoutedEventArgs e) { try { using (new WaitCursor()) { var connectString = ConfigurationManager.ConnectionStrings["TIMBANGANEntities"].ConnectionString; var entityStringBuilder = new EntityConnectionStringBuilder(connectString); SqlConnectionStringBuilder SqlConnection = new SqlConnectionStringBuilder(entityStringBuilder.ProviderConnectionString); var PrinterName = ConfigurationManager.AppSettings["PrinterName"]; ReportDocument cryRpt = new ReportDocument(); // this will be in a temp directory. string SystemPath = System.AppDomain.CurrentDomain.BaseDirectory; //once you have the path you get the directory with: var directory = System.IO.Path.GetDirectoryName(SystemPath); var Id = 0; try { Id = Int32.Parse(txtID.Text); } catch (Exception) { } cryRpt.Load(SystemPath + "\\Reports\\ReportSlipTimbangan.rpt"); cryRpt.SetDatabaseLogon(SqlConnection.UserID, SqlConnection.Password, SqlConnection.DataSource, SqlConnection.InitialCatalog); cryRpt.SetParameterValue("id", Id); //cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, fullPath); System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(); var paper = new System.Drawing.Printing.PaperSize("Custom", 300, 600); printersettings.DefaultPageSettings.Landscape = false; printersettings.DefaultPageSettings.PaperSize = paper; pageSettings.PaperSize = paper; pageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); pageSettings.Landscape = false; var nama = System.Drawing.Printing.PrinterSettings.InstalledPrinters; printersettings.PrinterName = PrinterName; cryRpt.PrintToPrinter(printersettings, pageSettings, false); MessageBox.Show("File Printing", Constans.SubmitMessageTittle.Sukses, MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception exp) { LogError.WriteError(exp); MessageBox.Show(Constans.SubmitMessage.Error, Constans.SubmitMessageTittle.Error, MessageBoxButton.OK, MessageBoxImage.Error); } }
public RdlcReport(String code, int num) { this.code = code; this.num = num; InitializeComponent(); System.Drawing.Printing.PageSettings ps = reportViewer1.GetPageSettings();// new System.Drawing.Printing.PageSettings(); ps.Landscape = false; reportViewer1.SetPageSettings(ps); }
// /// <summary> /// Determines page settings for current page e.g. Orientation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> private void QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { // var pgsTemp = new System.Drawing.Printing.PageSettings(); pgsTemp.Landscape = mblnLandscape; e.PageSettings = pgsTemp; // }
public ReportSettings() { this.pageSize = GlobalValues.DefaultPageSize; BaseValues(); var x = PdfSharp.PageSizeConverter.ToSize(PdfSharp.PageSize.A4); //http://www.sizepaper.com/a-series/a4 //http://www.sizepaper.com/american-loose var paperProp = new System.Drawing.Printing.PageSettings(); var p = paperProp.PaperSize.PaperName.ToString(); }
public static void ShowPrintDialog() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing(); // Create PdfViewer object PdfViewer viewer = new PdfViewer(); // Open input PDF file viewer.BindPdf( dataDir + "input.pdf"); // Set attributes for printing viewer.AutoResize = true; // Print the file with adjusted size viewer.AutoRotate = true; // Print the file with adjusted rotation viewer.PrintPageDialog = false; // Do not produce the page number dialog when printing // Create objects for printer and page settings and PrintDocument System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument(); // Set printer name ps.PrinterName = prtdoc.PrinterSettings.PrinterName; // Set PageSize (if required) pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); // Set PageMargins (if required) pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); // ExStart:PrintDialog System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog(); if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // Document printing code goes here // Print document using printer and page settings viewer.PrintDocumentWithSettings(pgs, ps); } // ExEnd:PrintDialog // Close the PDF file after priting viewer.Close(); }
public static void Run() { // ExStart:PrintoXPSPrinter // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing(); // Create PdfViewer object PdfViewer viewer = new PdfViewer(); // Open input PDF file viewer.BindPdf( dataDir + "input.pdf"); // Set attributes for printing viewer.AutoResize = true; // Print the file with adjusted size viewer.AutoRotate = true; // Print the file with adjusted rotation viewer.PrintPageDialog = false; // Do not produce the page number dialog when printing // Create objects for printer and page settings and PrintDocument System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); // Set XPS/PDF printer name ps.PrinterName = "Microsoft XPS Document Writer"; // Or set the PDF printer // Ps.PrinterName = "Adobe PDF"; // Set PageSize (if required) pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); // Set PageMargins (if required) pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); // Print document using printer and page settings viewer.PrintDocumentWithSettings(pgs, ps); // Close the PDF file after priting viewer.Close(); // ExEnd:PrintoXPSPrinter }
public void Print(bool useDefaultPrinter, string printerName) { //create PdfViewer object PdfViewer viewer = new PdfViewer(); //open input PDF file viewer.OpenPdfFile(path); //set attributes for printing viewer.AutoResize = true; //print the file with adjusted size viewer.AutoRotate = true; //print the file with adjusted rotation viewer.PrintPageDialog = false; //do not produce the page number dialog when printing //create objects for printer and page settings and PrintDocument System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument(); //set printer name if (useDefaultPrinter) ps.PrinterName = prtdoc.PrinterSettings.PrinterName; else ps.PrinterName = printerName; //set PageSize (if required) pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); //set PageMargins (if required) pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); //print document using printer and page settings viewer.PrintDocumentWithSettings(pgs, ps); //close the PDF file after priting viewer.ClosePdfFile(); }
private void Invoice_report_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'accountingsystemDataSet_invoice_report.temp_invoice_print' table. You can move, or remove it, as needed. //this.temp_invoice_printTableAdapter.Fill(this.accountingsystemDataSet_invoice_report.temp_invoice_print); // TODO: This line of code loads data into the 'accountingsystemDataSet_currentInvoice.temp_invoice_print' table. You can move, or remove it, as needed. // this.temp_invoice_printTableAdapter.Fill(this.accountingsystemDataSet_currentInvoice.temp_invoice_print); // this.reportViewer1.RefreshReport(); ReportDataSource ds = new ReportDataSource(); ds.Name = "DataSet1"; ds.Value = GenerateData(); ReportDataSource ds1 = new ReportDataSource(); ds1.Name = "DataSet2"; ds1.Value = GeneratePaymentData(); this.reportViewer1.ProcessingMode = ProcessingMode.Local; this.reportViewer1.LocalReport.ReportPath = "Report3.rdlc"; this.reportViewer1.LocalReport.DataSources.Add(ds); this.reportViewer1.LocalReport.DataSources.Add(ds1); System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); pg.Margins.Top = 0; pg.Landscape = true; pg.Margins.Bottom = 0; // pg.Margins.Left = 1; // pg.Margins.Right = 1; //System.Drawing.Printing.PaperSize size = new PaperSize(); //size.RawKind = (int)PaperKind.A5; //pg.PaperSize = size; this.reportViewer1.SetPageSettings(pg); this.reportViewer1.RefreshReport(); this.reportViewer2.RefreshReport(); }
public QueryPageSettingsEventArgs(System.Drawing.Printing.PageSettings pageSettings) { this.pageSettings = pageSettings; }
public static void Run() { try { // ExStart:CheckPrintJobStatus // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Printing(); // Instantiate PdfViewer object PdfViewer viewer = new PdfViewer(); // Bind source PDF file viewer.BindPdf(dataDir + "input.pdf"); viewer.AutoResize = true; // Hide printing dialog viewer.PrintPageDialog = false; // Create Printer Settings object System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(); System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument(); // Specify the printer anme ps.PrinterName = "Microsoft XPS Document Writer"; // Resultant Printout name ps.PrintFileName = "ResultantPrintout.xps"; // Print the output to file ps.PrintToFile = true; ps.FromPage = 1; ps.ToPage = 2; ps.PrintRange = System.Drawing.Printing.PrintRange.SomePages; // Specify the page size of printout pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169); ps.DefaultPageSettings.PaperSize = pgs.PaperSize; pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); // Print the document with settings specified above viewer.PrintDocumentWithSettings(pgs, ps); // Check the print status if (viewer.PrintStatus != null) { // An exception was thrown Exception ex = viewer.PrintStatus as Exception; if (ex != null) { // Get exception message } } else { // No errors were found. Printing job has completed successfully Console.WriteLine("printing completed without any issue.."); } // ExEnd:CheckPrintJobStatus } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void PrintTicket() { System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument(); System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); doc.DocumentName = "tiket.pdf"; doc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(doc_PrintPage); doc.Print(); }
private void Payments_Report_Load(object sender, EventArgs e) { ReportDataSource ds = new ReportDataSource(); ds.Name = "DataSet1"; ds.Value = GenerateData(); /* ReportDataSource ds1 = new ReportDataSource(); ds1.Name = "DataSet2"; ds1.Value = GeneratePaymentData();*/ /* ReportDataSource ds2 = new ReportDataSource(); ds2.Name = "DataSet3"; ds2.Value = GenerateData();*/ this.reportViewer1.ProcessingMode = ProcessingMode.Local; this.reportViewer1.LocalReport.ReportPath = "Report4.rdlc"; this.reportViewer1.LocalReport.DataSources.Add(ds); //this.reportViewer1.LocalReport.DataSources.Add(ds1); // this.reportViewer1.LocalReport.DataSources.Add(ds2); System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings(); pg.Margins.Top = 0; pg.Landscape = true; pg.Margins.Bottom = 0; // pg.Margins.Left = 1; // pg.Margins.Right = 1; //System.Drawing.Printing.PaperSize size = new PaperSize(); //size.RawKind = (int)PaperKind.A5; //pg.PaperSize = size; this.reportViewer1.SetPageSettings(pg); this.reportViewer1.RefreshReport(); }
private void GenerateReport(TimeCardDataSet1.EmployeesRow employee) { //get the week range data to add to the employee object WeekRangeData weeksForPeriod = new WeekRangeData(); //get the shift start time based off their employee number DateTime shiftStart = ShiftNoToStart[employee.Shift]; // used to calculate overtime var isCalifornia = employee.address.Contains(", CA"); // create object for employee detail var emps = new List<EmployeeDetails>(); var emp = new EmployeeDetails { EmployeeID = employee.EmployeeID, EmpName = employee.EmpName, StartDate = startPick.Value.ToShortDateString(), EndDate = endPick.Value.ToShortDateString(), PeriodEnd = endPick.Value.ToShortDateString(), PeriodStart = startPick.Value.ToShortDateString() }; emps.Add(emp); // get the transactions for the report var adpt = new TimeCardDataSet1TableAdapters.FlexibleTransactionComTableAdapter(); adpt.FillByEnrollNo(this.timeCardDataSet1.FlexibleTransactionCom, employee.EmployeeID); var transAdpt = new TimeCardDataSet1TableAdapters.TransactionsTableAdapter(); transAdpt.FillByEnrollNoAndDate(this.timeCardDataSet1.Transactions, employee.EmployeeID, startPick.Value, endPick.Value); // build the object var report = new List<Joshua>(); int clockins = 0; foreach (var trans in this.timeCardDataSet1.Transactions) { bool logout = false; Joshua toAdd = new Joshua { Date = trans.LogDate, //InTime = trans.IsLogInNull() ? "" : trans.LogIn.ToString("hh:mm tt"), //OutTime = trans.IsLogOutNull() ? "" : trans.LogOut.ToString("hh:mm tt"), ActualTime = "", OT = 0, D = 0, PayTime = "", // ScheduledTime = trans.IsLogInNull() ? "" : shiftStart.ToString("hh:mm tt"), Comments = "", isUtah = !isCalifornia, EmployeeID = emp.EmployeeID, EmpName = emp.EmpName }; if (trans.TempInOutMode == "CI") { toAdd.InTime = trans.LogTime.ToString("hh:mm tt"); toAdd.LowStart = trans.LogTime; clockins++; toAdd.Line = clockins; } else { try { toAdd = (from t in report where t.Date == trans.LogDate && t.Line == clockins select t).First(); logout = true; } catch(Exception exp) { toAdd.LowStart = trans.LogTime; toAdd.InTime = "Missing"; } toAdd.OutTime = trans.LogTime.ToString("hh:mm tt"); } try { // get the comment if (!trans.IsfldRemarksNull()) { toAdd.Comments += trans.fldRemarks; } } catch { } //these variable will hold a date times for employees paid start and end times DateTime LOWStart = new DateTime(); DateTime LOWEnd = new DateTime(); //make adjustments to the Joshua's log in time to calculate the pay time if (trans.TempInOutMode == "CI") { var compareTime = new DateTime(1, 1, 1, trans.LogTime.Hour, trans.LogTime.Minute, 0); //if the employee arrived before their scheduled start time if (shiftStart > compareTime) { toAdd.PayTime += shiftStart.ToString("hh:mm tt"); LOWStart = shiftStart; } else // then they are payed from the closest 15 minute interval after they arrived { var roundedStart = roundToNearest15(trans.LogTime); var payStart = roundedStart.ToString("hh:mm tt"); toAdd.PayTime += payStart; LOWStart = roundedStart; } } //make adjustments to the Joshua's log out time to calculate the pay time else if (trans.TempInOutMode == "CO") { LOWStart = toAdd.LowStart; var roundedEnd = roundToNearest15(trans.LogTime); toAdd.PayTime += "\n" + roundedEnd.ToString("hh:mm tt"); LOWEnd = roundedEnd; } //day shift employees if (employee.Shift == 0) { toAdd.ScheduledTime = ShiftNoToStart[0].ToString("hh:mm tt"); toAdd.ScheduledTime += "\n" + ShiftNoToEnd[0].ToString("hh:mm tt"); } else { toAdd.ScheduledTime = toAdd.PayTime; } TimeSpan LOWSpan = (LOWEnd - LOWStart); double LOWPaid = Math.Round(LOWSpan.Hours + (double)LOWSpan.Minutes / 60, 2); toAdd.LOW = LOWPaid; if (!logout) { report.Add(toAdd); } } /*foreach (var trans in this.timeCardDataSet1.FlexibleTransactionCom) { if (!trans.IsLOWNull()) { Joshua toAdd = new Joshua { Date = trans.LogDate, InTime = trans.IsLogInNull() ? "" : trans.LogIn.ToString("hh:mm tt"), OutTime = trans.IsLogOutNull() ? "" : trans.LogOut.ToString("hh:mm tt"), ActualTime = "", OT = 0, D = 0, PayTime = "", // ScheduledTime = trans.IsLogInNull() ? "" : shiftStart.ToString("hh:mm tt"), Comments = "", isUtah = !isCalifornia, EmployeeID = emp.EmployeeID, EmpName = emp.EmpName }; try { // get the comment var comment = (from t in this.timeCardDataSet1.Transactions where t.LogDate == trans.LogDate && !t.IsfldRemarksNull() select t); if (comment.Count() > 0) { toAdd.Comments = comment.First().fldRemarks; } } catch { } //these variable will hold a date times for employees paid start and end times DateTime LOWStart = new DateTime(); DateTime LOWEnd = new DateTime(); //make adjustments to the Joshua's log in time to calculate the pay time if (!trans.IsLogInNull()) { var compareTime = new DateTime(1, 1, 1, trans.LogIn.Hour, trans.LogIn.Minute, 0); //if the employee arrived before their scheduled start time if (shiftStart > compareTime) { toAdd.PayTime += shiftStart.ToString("hh:mm tt"); LOWStart = shiftStart; } else // then they are payed from the closest 15 minute interval after they arrived { var roundedStart = roundToNearest15(trans.LogIn); var payStart = roundedStart.ToString("hh:mm tt"); toAdd.PayTime += payStart; LOWStart = roundedStart; } } //make adjustments to the Joshua's log out time to calculate the pay time if (!trans.IsLogOutNull()) { var roundedEnd = roundToNearest15(trans.LogOut); toAdd.PayTime += "\n" + roundedEnd.ToString("hh:mm tt"); LOWEnd = roundedEnd; } //day shift employees if (employee.Shift == 0) { toAdd.ScheduledTime = ShiftNoToStart[0].ToString("hh:mm tt"); toAdd.ScheduledTime += "\n" + ShiftNoToEnd[0].ToString("hh:mm tt"); } else { toAdd.ScheduledTime = toAdd.PayTime; } TimeSpan LOWSpan = (LOWEnd - LOWStart); double LOWPaid = Math.Round(LOWSpan.Hours + (double)LOWSpan.Minutes / 60, 2); toAdd.LOW = LOWPaid; report.Add(toAdd); } }*/ // check for an empty employee if (report.Count <= 0) { report.Add(new Joshua { Date = DateTime.Now, EmployeeID = emp.EmployeeID, EmpName = emp.EmpName }); } // handle over time depending on california employees var dates = (from r in report select r.Date).Distinct(); //var firstWeek = report.Min(m => m.Week); if (isCalifornia) { foreach (var date in dates) { // get the items for that day var items = (from r in report where r.Date == date select r).ToList(); var total = items.Sum(m => m.LOW); if (total > 8) { items.Last().OT = total - 8; } } } else { var weeks = (from r in report select r.Week).Distinct(); foreach (var week in weeks) { var items = (from r in report where r.Week == week select r).ToList(); double amt = 0; foreach (var item in items) { amt = amt + item.LOW; if (amt > 40) { item.OT = amt - 40; amt = 40; } } } } this.reportViewer1.LocalReport.DataSources.Clear(); // add transactions to the report this.reportViewer1.LocalReport.DataSources.Add( new Microsoft.Reporting.WinForms.ReportDataSource("TransactionSet", report)); // add the employee detail to the report this.reportViewer1.LocalReport.DataSources.Add( new Microsoft.Reporting.WinForms.ReportDataSource("EmployeeSet", (object)emps)); //add the week range detail to the report //TODO: Need to figure out how to bind this additional data source to the report var weekData = new List<WeekRangeData>(); this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("WeekSet", (object) weekData)); System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings(); ps.Landscape = true; ps.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1170); ps.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.A4; reportViewer1.SetPageSettings(ps); // refresh the report this.reportViewer1.RefreshReport(); }
private void TelaRelatorio_Load(object sender, EventArgs e) { System.Drawing.Printing.PageSettings NovasMargens = new System.Drawing.Printing.PageSettings(); NovasMargens.Margins.Bottom = 4; NovasMargens.Margins.Left = 4; NovasMargens.Margins.Right = 4; NovasMargens.Margins.Top = 4; reportViewer1.SetPageSettings(NovasMargens); this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomPercent = 100; }