protected void btnbuscar_Click2(object sender, EventArgs e) { string company, fechaini, fechafin; company = ""; //usuario = ""; fechafin = ""; fechafin = ""; company = txtcompany3.Text.ToString(); //usuario = txtUsuario.Text.ToString(); fechaini = txtfechaini3.Text.ToString(); fechafin = txtfechafin3.Text.ToString(); ObtenerIndicadorNivelCumplimiento2(company, fechaini, fechafin); DataTable table = ConvertListToDataTable2(Indicadores2); ReportViewer2.Reset(); ReportViewer2.LocalReport.ReportPath = Server.MapPath("~/Content/Report/Report2.rdlc"); ReportDataSource rds = new ReportDataSource("DataSet1", table); ReportViewer2.LocalReport.DataSources.Clear(); ReportViewer2.LocalReport.DataSources.Add(rds); ReportViewer2.DataBind(); ReportViewer2.LocalReport.Refresh(); }
private void show_report() { ReportViewer2.Reset(); DataTable dt = Queries2.flybuygoa(TextBox1.Text, TextBox2.Text, TextBox3.Text); DataTable dt2 = Queries2.Seapdate(TextBox1.Text); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportDataSource rds2 = new ReportDataSource("DataSet2", dt2); ReportViewer2.LocalReport.DataSources.Add(rds); ReportViewer2.LocalReport.DataSources.Add(rds2); ReportViewer2.LocalReport.ReportPath = "reports/flybuygoa.rdlc"; ReportParameter[] rptParam = new ReportParameter[] { new ReportParameter("input", TextBox1.Text), new ReportParameter("venue", TextBox2.Text), new ReportParameter("gvenue", TextBox3.Text), }; ReportViewer2.LocalReport.SetParameters(rptParam); ReportViewer2.LocalReport.Refresh(); }
protected void ShowReport() { DataTable dt = GetData(); ReportViewer1.Reset(); ReportViewer1.AsyncRendering = AsyncMode.Checked; ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.ReportPath = "Reports/Report1.rdlc"; ReportViewer1.LocalReport.DisplayName = "Report1"; ReportViewer1.LocalReport.Refresh(); ReportViewer1.ShowFindControls = false; ReportViewer1.ShowPrintButton = false; ReportViewer1.ShowFindControls = false; ReportViewer1.ShowZoomControl = false; ReportViewer1.ShowRefreshButton = false; ReportViewer1.ShowBackButton = false; ReportViewer1.Visible = Show1.Checked; ReportViewer2.Reset(); ReportViewer2.AsyncRendering = AsyncMode.Checked; ReportDataSource rds2 = new ReportDataSource("DataSet1", dt); ReportViewer2.LocalReport.DataSources.Add(rds2); ReportViewer2.LocalReport.ReportPath = "Reports/Report2.rdlc"; ReportViewer2.LocalReport.DisplayName = "Report2"; ReportViewer2.LocalReport.Refresh(); ReportViewer2.ShowFindControls = false; ReportViewer2.ShowPrintButton = false; ReportViewer2.ShowFindControls = false; ReportViewer2.ShowZoomControl = false; ReportViewer2.ShowRefreshButton = false; ReportViewer2.ShowBackButton = false; ReportViewer2.Visible = Show2.Checked; ReportViewer2.Visible = true; ReportViewer3.Reset(); ReportViewer3.AsyncRendering = AsyncMode.Checked; ReportDataSource rds3 = new ReportDataSource("DataSet1", dt); ReportViewer3.LocalReport.DataSources.Add(rds2); ReportViewer3.LocalReport.ReportPath = "Reports/Report3.rdlc"; ReportViewer3.LocalReport.DisplayName = "Report3"; ReportViewer3.LocalReport.Refresh(); ReportViewer3.ShowFindControls = false; ReportViewer3.ShowPrintButton = false; ReportViewer3.ShowFindControls = false; ReportViewer3.ShowZoomControl = false; ReportViewer3.ShowRefreshButton = false; ReportViewer3.ShowBackButton = false; ReportViewer3.Visible = Show3.Checked; }
private void ShowReportDailyDueStatement(int pMemberCaregoryID, string pMemberCode) { ReportViewer2.Reset(); DataTable dt = GetDailyDueStatement(pMemberCaregoryID, pMemberCode); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer2.LocalReport.DataSources.Add(rds); this.ReportViewer2.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; if (!string.IsNullOrEmpty(pMemberCode)) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberAllDueStatement.rdlc"; } else { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "DailyDueStatement.rdlc"; } ReportViewer2.LocalReport.Refresh(); string PDFPath = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/")) + "PDF\\"; Microsoft.Reporting.WebForms.Warning[] warnings = null; string[] streamids = null; String mimeType = null; String encoding = null; String extension = null; Byte[] bytes = null; if (!string.IsNullOrEmpty(pMemberCode)) { fileName = "MemberDueStatement" + DateTime.Now.ToFileTime() + ".pdf"; } else { fileName = "DailyDueStatement" + DateTime.Now.ToFileTime() + ".pdf"; } bytes = ReportViewer2.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); bool IsExitsPDF = File.Exists(PDFPath + fileName); FileStream fs = new FileStream(PDFPath + fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite); byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); PdfLocation = PDFPath + fileName; //report.Attributes.Add("src", "../PDF/" + fileName); report.Attributes.Add("src", "../PDF/" + fileName); //return_BalancheRptForm.Visible = true; }
private void showreport() { ReportViewer2.Reset(); DataTable dt = GetData(Int32.Parse(txtid.Text)); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer2.LocalReport.DataSources.Add(rds); ReportViewer2.LocalReport.ReportPath = "Report1.rdlc"; ReportParameter[] param = new ReportParameter[] { new ReportParameter("id", txtid.Text), new ReportParameter("Dates", txtdt.Text) }; ReportViewer2.LocalReport.SetParameters(param); ReportViewer2.LocalReport.Refresh(); }
private void ShowReportDailyRegistrationStatement(int pMemberID, int pPayTypeID, DateTime frDate, DateTime toDate) { ReportViewer2.Reset(); DataTable dt = GetDailyRegistrationStatement(pMemberID, pPayTypeID, frDate, toDate); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer2.LocalReport.DataSources.Add(rds); this.ReportViewer2.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "DailyRegistrationStatement.rdlc"; ReportParameter[] parameter = new ReportParameter[] { new ReportParameter("FromDate", frDate.ToString()), new ReportParameter("ToDate", toDate.ToString()) }; ReportViewer2.LocalReport.SetParameters(parameter); ReportViewer2.LocalReport.Refresh(); string PDFPath = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/")) + "PDF\\"; Microsoft.Reporting.WebForms.Warning[] warnings = null; string[] streamids = null; String mimeType = null; String encoding = null; String extension = null; Byte[] bytes = null; fileName = "DailyRegistrationStatement" + DateTime.Now.ToFileTime() + ".pdf"; bytes = ReportViewer2.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); bool IsExitsPDF = File.Exists(PDFPath + fileName); FileStream fs = new FileStream(PDFPath + fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite); byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); PdfLocation = PDFPath + fileName; //report.Attributes.Add("src", "../PDF/" + fileName); report.Attributes.Add("src", "../PDF/" + fileName); //return_BalancheRptForm.Visible = true; }
private async void btnDateSearch_Click(object sender, RoutedEventArgs e) { ReportViewer2.Reset(); if (DPFrom != null && DPTo != null && DPFrom.SelectedDate != null && DPTo.SelectedDate != null) { DateTime beginningDate = DPFrom.SelectedDate.Value.Date; DateTime endingDate = DPTo.SelectedDate.Value.Date; DataTable dt = await Task.Run(() => reportDAL.getDetailedSalesByDate(beginningDate, endingDate)); ReportDataSource ds = new ReportDataSource("DetailedTransactionDataSet", dt); ReportViewer2.LocalReport.DataSources.Add(ds); ReportViewer2.LocalReport.ReportEmbeddedResource = "LoginUI.Report.DetailedTransactionReport.rdlc"; ReportViewer2.RefreshReport(); } else { MessageBox.Show("Please select the date."); } }
protected void ExportToPDF(object sender, EventArgs e) { try { if (DropDownList1.SelectedValue != "") { string fno = "010702"; string fname = "PENGESAHAN MAKLUMAT DIVIDEN"; DataTable dt = new DataTable(); dt = DBCon.Ora_Execute_table("select row_number() OVER (ORDER BY c.kavasan_name,c.Wilayah_Name,branch_desc,mem_centre,mem_new_icno) as Id,a.mem_new_icno,a.mem_name,a.mem_centre,a.mem_sahabat_no,a.mem_address, sum(a.div_debit_amt) div_debit_amt,sha_amt as jumlah,c.kavasan_name,c.Wilayah_Name,c.branch_desc as cawangan_name,a.div_bank_acc_no,c1.Bank_Name from (select mm.mem_new_icno,mm.mem_name,mm.mem_centre,mm.mem_member_no as mem_sahabat_no,mm.mem_address,sum(md.div_debit_amt) as div_debit_amt,sha_amt,mm.mem_region_cd,mm.mem_branch_cd,md.div_batch_name,div_bank_cd,div_bank_acc_no from mem_member mm inner join mem_divident md on md.div_new_icno=mm.mem_new_icno and md.Acc_sts ='Y' where mm.Acc_sts ='Y' group by mem_new_icno,mem_name,mem_centre,mem_member_no,sha_amt,mem_address,mm.mem_region_cd,mm.mem_branch_cd,md.div_batch_name,div_bank_cd,div_bank_acc_no) a left join (select kavasan_name,wilayah_name,cawangan_code branch_cd, cawangan_name branch_desc from Ref_Cawangan rw where Isnull(cawangan_code,'') !='')c on a.mem_branch_cd=c.branch_cd left join (select rnb.Bank_Code,rnb.Bank_Name from Ref_Nama_Bank rnb)c1 on a.div_bank_cd=c1.Bank_Code where a.div_batch_name='" + DropDownList1.SelectedItem.Text + "' group by a.mem_new_icno,a.mem_name,a.mem_centre,a.mem_sahabat_no,sha_amt,a.mem_address,c.kavasan_name,c.Wilayah_Name,c.branch_desc,a.div_bank_acc_no,c1.Bank_Name Order by c.kavasan_name,c.Wilayah_Name,branch_desc,mem_centre,mem_new_icno"); // Reset ReportViewer2.Reset(); List <DataRow> listResult = dt.AsEnumerable().ToList(); listResult.Count(); int countRow = 0; countRow = listResult.Count(); if (countRow != 0) { string Inssql = "insert into cmn_audit_trail(aud_crt_id,aud_crt_dt,aud_txn_cd,aud_txn_desc)values('" + Session["New"].ToString() + "','" + DateTime.Now.ToString() + "','" + fno + "','" + fname + "')"; Status = dbcon.Ora_Execute_CommamdText(Inssql); txtError.Text = ""; //Display Report ReportDataSource rds = new ReportDataSource("DIV_MAK", dt); ReportViewer2.LocalReport.DataSources.Add(rds); //Path ReportViewer2.LocalReport.ReportPath = "keanggotan/Mak_Div.rdlc"; //ToDate.Text = today.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); //Parameters ReportParameter[] rptParams = new ReportParameter[] { new ReportParameter("Kelompok", DropDownList1.SelectedItem.Text), new ReportParameter("current_date", DateTime.Now.ToString()) //new ReportParameter("toDate",ToDate .Text ) //new ReportParameter("fromDate",dmula.ToShortDateString() ), //new ReportParameter("toDate",dakhir.ToShortDateString() ) }; ReportViewer2.LocalReport.SetParameters(rptParams); //Refresh ReportViewer2.LocalReport.Refresh(); string filename = string.Format("{0}.{1}", "PENGESAHAN_DIVIDEN_" + DateTime.Now.ToString("ddMMyyyy") + "", "pdf"); ReportViewer2.LocalReport.DisplayName = "PENGESAHAN_DIVIDEN_" + DateTime.Now.ToString("ddMMyyyy"); //} Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = ReportViewer2.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=" + filename); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); } else if (countRow == 0) { txtError.Text = "Rekod tidak dijumpai. Sila pastikan semua maklumat dimasukkan dengan betul."; } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Sila Pilih Nama Kelompok.',{'type': 'warning','title': 'warning','auto_close': 2000});", true); } } catch (Exception ex) { } }
private void ShowReportBillCollectionSummaryStatement(int pMemberID, DateTime frDate, DateTime toDate, int pPayTypeID) { ReportViewer2.Reset(); DataTable dt = GetMember_CollectionSummary(pMemberID, frDate, toDate, pPayTypeID); ReportDataSource rds = new ReportDataSource("DataSet1", dt); ReportViewer2.LocalReport.DataSources.Add(rds); this.ReportViewer2.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; if (pPayTypeID == 0) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberCollectionSummaryReport.rdlc"; } if (pPayTypeID == 1) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberCollectionSummaryCashReport.rdlc"; } if (pPayTypeID == 2) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberCollectionSummaryChequeReport.rdlc"; } if (pPayTypeID == 3) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberCollectionSummaryMemberCardReport.rdlc"; } if (pPayTypeID == 4) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberCollectionSummaryBankCardReport.rdlc"; } if (pPayTypeID == 5) { ReportViewer2.LocalReport.ReportPath = Server.MapPath("/Controls/") + "MemberCollectionSummaryDueReport.rdlc"; } ReportViewer2.LocalReport.Refresh(); string PDFPath = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/")) + "PDF\\"; Microsoft.Reporting.WebForms.Warning[] warnings = null; string[] streamids = null; String mimeType = null; String encoding = null; String extension = null; Byte[] bytes = null; fileName = "MemberCollectionSummaryReport" + DateTime.Now.ToFileTime() + ".pdf"; bytes = ReportViewer2.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); bool IsExitsPDF = File.Exists(PDFPath + fileName); FileStream fs = new FileStream(PDFPath + fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite); byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); PdfLocation = PDFPath + fileName; //report.Attributes.Add("src", "../PDF/" + fileName); report.Attributes.Add("src", "../PDF/" + fileName); //return_BalancheRptForm.Visible = true; }
public void showreport() { try { //string fdate = TxtFdate.Text; string fmdate = TxtFdate.Text; DateTime ft = DateTime.ParseExact(fmdate, "dd/mm/yyyy", CultureInfo.InvariantCulture); String fdate = ft.ToString("yyyy-mm-dd"); string todate = TxtTdate.Text; DateTime td = DateTime.ParseExact(todate, "dd/mm/yyyy", CultureInfo.InvariantCulture); String tdate = td.ToString("yyyy-mm-dd"); DateTime dmula; DateTime dakhir; dmula = DateTime.ParseExact(fdate, "yyyy-mm-dd", CultureInfo.InvariantCulture); dakhir = DateTime.ParseExact(tdate, "yyyy-mm-dd", CultureInfo.InvariantCulture); string sts = ddadu.SelectedItem.Value; DateTime today = DateTime.Now; //DataSource DataTable dt = new DataTable(); dmula = today; dakhir = today; // DataTable dt = GetData(DateTime.Parse(datedari), DateTime.Parse(datehingga), nokp, pusat, Caw, Zon, Wil); if ((fdate == "") && (tdate == "")) { dmula = today; dakhir = today; //ToDate.Text = today.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); //FromDate.Text = today.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); TxtTdate.Text = today.ToString("yyyy-mm-dd", CultureInfo.InvariantCulture); TxtFdate.Text = today.ToString("yyyy-mm-dd", CultureInfo.InvariantCulture); dt = GetData(fdate, tdate, sts); } //date mula ada, date akhir ada else if ((fdate != "") && (tdate != "")) { // dmula = DateTime.ParseExact(datedari, "MM/dd/yyyy", CultureInfo.InvariantCulture); // dakhir = DateTime.ParseExact(datehingga, "MM/dd/yyyy", CultureInfo.InvariantCulture); dmula = DateTime.ParseExact(fdate, "yyyy-mm-dd", CultureInfo.InvariantCulture); dakhir = DateTime.ParseExact(tdate, "yyyy-mm-dd", CultureInfo.InvariantCulture); dt = GetData(fdate, tdate, sts); } //date mula ada, date akhir tiada else if ((fdate != "") && (tdate == "")) { // dmula = DateTime.ParseExact(datedari, "MM/dd/yyyy", CultureInfo.InvariantCulture); dmula = DateTime.ParseExact(fdate, "yyyy-mm-dd", CultureInfo.InvariantCulture); dakhir = today; //ToDate.Text = today.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); TxtTdate.Text = today.ToString("yyyy-mm-dd", CultureInfo.InvariantCulture); //("MM/dd/yyyy HH:mm:ss.fff", // CultureInfo.InvariantCulture); dt = GetData(fdate, tdate, sts); } else if ((fdate == "") && (tdate != "")) { dmula = today; // dakhir = DateTime.ParseExact(datehingga, "MM/dd/yyyy", CultureInfo.InvariantCulture); // FromDate.Text = today.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); dakhir = DateTime.ParseExact(tdate, "yyyy-mm-dd", CultureInfo.InvariantCulture); TxtFdate.Text = today.ToString("yyyy-mm-dd", CultureInfo.InvariantCulture); //kena add exception error, date akhir tak boleh previous dr date mula dt = GetData(fdate, tdate, sts); } //Reset ReportViewer2.Reset(); List <DataRow> listResult = dt.AsEnumerable().ToList(); listResult.Count(); int countRow = 0; countRow = listResult.Count(); if (countRow != 0) { //txtError.Text = ""; ss1.Visible = true; //Display Report ReportDataSource rds = new ReportDataSource("ADU_CET", dt); ReportViewer2.LocalReport.DataSources.Add(rds); //Path ReportViewer2.LocalReport.ReportPath = "keanggotan/CET_ADU.rdlc"; //ToDate.Text = today.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); //Parameters string status; if (ddadu.SelectedItem.Text == "--- PILIH ---") { status = "SEMUA"; } else { status = ddadu.SelectedItem.Text; } ReportParameter[] rptParams = new ReportParameter[] { new ReportParameter("fromDate", TxtFdate.Text), new ReportParameter("toDate", TxtTdate.Text), new ReportParameter("Status", status), new ReportParameter("current_date", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; ReportViewer2.LocalReport.SetParameters(rptParams); //Refresh ReportViewer2.LocalReport.Refresh(); string filename = string.Format("{0}.{1}", "Cetak_Aduan_" + DateTime.Now.ToString("ddMMyyyy") + "", "pdf"); ReportViewer2.LocalReport.DisplayName = "Cetak_Aduan_" + DateTime.Now.ToString("ddMMyyyy"); //} Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = ReportViewer2.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=" + filename); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); } else if (countRow == 0) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Tiada Rekod Dijumpai Dalam Julat Tarikh Yang Dimasukkan.',{'type': 'warning','title': 'Warning','auto_close': 2000});", true); //txtError.Text = "Maklumat Carian Tidak Dijumpai"; } } catch (Exception ex) { //txtError.Text = ex.ToString(); } }