private void RefreshReportViewer() { if (dtpTahun.Value == null) { dtpTahun.Value = DateTime.Now; } switch (radPageView1.SelectedPage.Name.ToLower()) { case "rpvinput": break; case "rpvtotals": //Print Slip Gaji //rptGajiTHRTotal gj = new rptGajiTHRTotal(); rptGajiTHRSummary gj = (rptGajiTHRSummary)reportViewer2.Report; gj.ReportParameters["templateid"].Value = (chkBayarRincian.Checked ? -2 : -1);; gj.ReportParameters["tipepembayaranid"].Value = 4; gj.ReportParameters["User"].Value = NBConfig.ValidUserName; int tahun = 0; tahun = dtpTahun.Value.Year; gj.ReportParameters["tahun"].Value = tahun; reportViewer2.RefreshReport(); break; case "rpvrincian": //Print Slip Gaji rptGajiTHRTotal gj2 = (rptGajiTHRTotal)reportViewer3.Report; gj2.ReportParameters["templateid"].Value = (chkBayarOleh.Checked ? -2 : -1); gj2.ReportParameters["tipepembayaranid"].Value = 4; gj2.ReportParameters["User"].Value = NBConfig.ValidUserName; tahun = 0; tahun = dtpTahun.Value.Year; gj2.ReportParameters["tahun"].Value = tahun; reportViewer3.RefreshReport(); break; case "rpvpreview": //Print Slip Gaji rptGajiTHR gj3 = (rptGajiTHR)reportViewer1.Report;; gj3.ReportParameters["templateid"].Value = (chkBayarOleh.Checked ? -2 : -1); gj3.ReportParameters["tipepembayaranid"].Value = 4; gj3.ReportParameters["User"].Value = NBConfig.ValidUserName; //gj3.ReportParameters["memberid"].Value = rddMember.SelectedValue; tahun = 0; tahun = dtpTahun.Value.Year; gj3.ReportParameters["tahun"].Value = tahun; reportViewer1.RefreshReport(); break; } }
private void chkBayarRincian_ToggleStateChanged(object sender, StateChangedEventArgs args) { rptGajiTHRTotal rpt = (rptGajiTHRTotal)reportViewer3.Report; rpt.ReportParameters["user"].Value = NBConfig.ValidUserName; rpt.ReportParameters["tipepembayaranid"].Value = 4; rpt.ReportParameters["templateid"].Value = (chkBayarRincian.Checked ? -2 : -1); int tahun = 0; if (dtpTahun.Value == null) { dtpTahun.Value = DateTime.Now; } tahun = dtpTahun.Value.Year; rpt.ReportParameters["tahun"].Value = tahun; reportViewer3.RefreshReport(); //RefreshReportViewer(); }
private void btnPrintTotalRincian_Click(object sender, EventArgs e) { DialogResult res = MessageBox.Show("Print Total THR. Siap kan kertas di printer." , "Print Total THR" , MessageBoxButtons.OKCancel , MessageBoxIcon.Question , MessageBoxDefaultButton.Button2 , MessageBoxOptions.DefaultDesktopOnly); if (res == System.Windows.Forms.DialogResult.OK) { //Print Slip Gaji rptGajiTHRTotal gj = new rptGajiTHRTotal(); gj.ReportParameters["templateid"].Value = (chkBayarRincian.Checked ? -2 : -1);; gj.ReportParameters["tipepembayaranid"].Value = 4; gj.ReportParameters["User"].Value = NBConfig.ValidUserName; int tahun = 0; if (dtpTahun.Value == null) { dtpTahun.Value = DateTime.Now; } tahun = dtpTahun.Value.Year; gj.ReportParameters["tahun"].Value = tahun; IReportDocument report1 = (IReportDocument)gj; ////set parameters when necessary //// PrinterSettings PrinterSettings printerSettings = new PrinterSettings(); //// Adjust the printer settings if necessary... InstanceReportSource reportSource = new InstanceReportSource(); reportSource.ReportDocument = report1; // Print the report using the printer settings. ReportProcessor reportProcessor = new ReportProcessor(); reportProcessor.PrintReport(reportSource, printerSettings); } }